You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running npm run dev works as expected, but npm run start is throwing an error.
> NODE_ENV=production node -r @babel/register -r marko/node-require src/server.js
/home/xxx/projects/lasso-express/node_modules/marko/dist/node-require/index.js:3
const complain;
^^^^^^^^
SyntaxError: Missing initializer in const declaration
at wrapSafe (internal/modules/cjs/loader.js:988:16)
at Module._compile (internal/modules/cjs/loader.js:1036:27)
at Module._compile (/home/xxx/projects/lasso-express/node_modules/pirates/lib/index.js:99:24)
at Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Object.newLoader [as .js] (/home/xxx/projects/lasso-express/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/home/xxx/projects/lasso-express/node_modules/marko/node-require.js:7:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `NODE_ENV=production node -r @babel/register -r marko/node-require src/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/xxx/.npm/_logs/2021-09-01T05_55_58_610Z-debug.log
Here's the log that npm gave.
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/home/xxx/.nvm/versions/node/v14.17.6/bin/node',
1 verbose cli '/home/xxx/.nvm/versions/node/v14.17.6/bin/npm',
1 verbose cli 'run',
1 verbose cli 'start'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /home/xxx/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/xxx/projects/lasso-express/node_modules/.bin:/home/xxx/.nvm/versions/node/v14.17.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
9 verbose lifecycle [email protected]~start: CWD: /home/xxx/projects/lasso-express
10 silly lifecycle [email protected]~start: Args: [
10 silly lifecycle '-c',
10 silly lifecycle 'NODE_ENV=production node -r @babel/register -r marko/node-require src/server.js'
10 silly lifecycle ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `NODE_ENV=production node -r @babel/register -r marko/node-require src/server.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/xxx/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:400:28)
13 verbose stack at ChildProcess.<anonymous> (/home/xxx/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:400:28)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/xxx/projects/lasso-express
16 verbose Linux 4.19.0-12-amd64
17 verbose argv "/home/xxx/.nvm/versions/node/v14.17.6/bin/node" "/home/xxx/.nvm/versions/node/v14.17.6/bin/npm" "run" "start"
18 verbose node v14.17.6
19 verbose npm v6.14.15
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `NODE_ENV=production node -r @babel/register -r marko/node-require src/server.js`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
The text was updated successfully, but these errors were encountered:
The reason for this error is that the "start" script is attempting to set an environment variable named 'NODE_ENV' using Linux-style scripting. If you are running the example on a Windows machine, the script will cause an error.
Specifically, the phrase "NODE_ENV=production" from the 'package.json' file is causing the error. The best way to resolve the problem universally is to create a separate file named ".env", then move "NODE_ENV=production" text (without the quotes) into that file. After this, you can use an npm package called "dotenv" to read the contents of your new env file to set the environment variable correctly.
Running
npm run dev
works as expected, butnpm run start
is throwing an error.Here's the log that npm gave.
The text was updated successfully, but these errors were encountered: