Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't work by following the readme #38

Closed
cybertouchllc opened this issue Jun 18, 2020 · 2 comments
Closed

Don't work by following the readme #38

cybertouchllc opened this issue Jun 18, 2020 · 2 comments

Comments

@cybertouchllc
Copy link

cybertouchllc commented Jun 18, 2020

Note: Creating a sapper project from the Dashboard and 0 config, works great, but I think that I cannot make authenticated apps with that approach since that template do sapper export instead of sapper build.

Don't know if that the main reason of the existence of this builder, or if it has more advantages to the one available as a template on Vercel.

I followed the readme and didn't worked, I get this in the logs:

[GET] /favicon.ico
01:43:36:42
2020-06-18T06:43:36.584Z	undefined	ERROR	Server is not listening Error: Cannot find module '/var/task/__sapper__/build/server/server.js'
Require stack:
- /var/task/launcher.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/var/task/launcher.js:20:14)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/launcher.js',
    '/var/runtime/UserFunction.js',
    '/var/runtime/index.js'
  ]
}
RequestId: 1fd8980d-7146-4da9-aa97-99e5c8c33d8e Error: Runtime exited with error: exit status 1
Runtime.ExitError

Package.json

"scripts": {
    "start": "sapper dev",
    "dev": "sapper dev --port $PORT",
    "build": "sapper build",
    "cy:run": "cypress run",
    "cy:open": "cypress open",
    "test": "run-p --race dev cy:run"
  },

Server.js

import sirv from 'sirv';
import polka from 'polka';
import compression from 'compression';
import * as sapper from '@sapper/server';

const { PORT = 3000, NODE_ENV } = process.env;
const dev = NODE_ENV === 'development';

const app = polka() // You can also use Express
app.use(
  compression({ threshold: 0 }),
  sirv('static', { dev }),
  sapper.middleware()
)

// if (!process.env.VERCEL_REGION) {
  app.listen(PORT, err => {
    if (err) console.log('error', err);
  });
// }

export default app

@roelandmoors
Copy link

roelandmoors commented Jun 19, 2020

I just tried it and it works fine. Did you ignore the __sapper__ folder?

@thgh
Copy link
Owner

thgh commented Jul 26, 2020

@cybertouchllc Please try out the new installation option or check out the examples folder.

@thgh thgh closed this as completed Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants