H
H
hmmmDanone2020-07-14 03:07:12
linux
hmmmDanone, 2020-07-14 03:07:12

What is the error when launching a React app?

Good afternoon! I'm trying to deploy a React application on the server, but it crashes with an error. I can't figure out from the logs why.

> [email protected] dev:unix /home/oem/projects/test-task
> NODE_ENV=development webpack && NODE_ENV=development nodemon ./src/server/index.js --watch ./src/server

Time: 1770ms
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] dev:unix: `NODE_ENV=development webpack && NODE_ENV=development nodemon ./src/server/index.js --watch ./src/server`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] dev:unix 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/oem/.npm/_logs/2020-07-13T23_34_30_164Z-debug.log


Here is the debug log:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/home/oem/.nvm/versions/node/v12.17.0/bin/node',
1 verbose cli   '/home/oem/.nvm/versions/node/v12.17.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'dev:unix'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev:unix', 'dev:unix', 'postdev:unix' ]
5 info lifecycle [email protected]~predev:unix: [email protected]
6 info lifecycle [email protected]~dev:unix: [email protected]
7 verbose lifecycle [email protected]~dev:unix: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~dev:unix: PATH: /home/oem/.nvm/versions/node/v12.17.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/oem/projects/test-task/node_modules/.bin:/home/oem/.nvm/versions/node/v12.17.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
9 verbose lifecycle [email protected]~dev:unix: CWD: /home/oem/projects/test-task
10 silly lifecycle [email protected]~dev:unix: Args: [
10 silly lifecycle   '-c',
10 silly lifecycle   'NODE_ENV=development webpack && NODE_ENV=development nodemon ./src/server/index.js --watch ./src/server'
10 silly lifecycle ]
11 silly lifecycle [email protected]~dev:unix: Returned: code: 2  signal: null
12 info lifecycle [email protected]~dev:unix: Failed to exec dev:unix script
13 verbose stack Error: [email protected] dev:unix: `NODE_ENV=development webpack && NODE_ENV=development nodemon ./src/server/index.js --watch ./src/server`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/home/oem/.nvm/versions/node/v12.17.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/home/oem/.nvm/versions/node/v12.17.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/oem/projects/test-task
16 verbose Linux 5.3.0-40-generic
17 verbose argv "/home/oem/.nvm/versions/node/v12.17.0/bin/node" "/home/oem/.nvm/versions/node/v12.17.0/bin/npm" "run" "dev:unix"
18 verbose node v12.17.0
19 verbose npm  v6.14.6
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] dev:unix: `NODE_ENV=development webpack && NODE_ENV=development nodemon ./src/server/index.js --watch ./src/server`
22 error Exit status 2
23 error Failed at the [email protected] dev:unix script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]


I am also attaching package.json.
...
"scripts": {
    "test": "NODE_ENV=test jest --detectOpenHandles",
    "dev:unix": "NODE_ENV=development webpack && NODE_ENV=development nodemon ./src/server/index.js --watch ./src/server",
    "dev:win": "set NODE_ENV=development&& webpack && nodemon ./src/server/index.js --watch ./src/server"
  },
  "author": "...",
  "license": "ISC",
  "dependencies": {
    "@hot-loader/react-dom": "^16.13.0",
    "axios": "^0.19.2",
    "cookie-parser": "^1.4.5",
    "cookie-session": "^1.4.0",
    "express": "^4.17.1",
    "mongoose": "^5.9.7",
    "multer": "^1.4.2",
    "passport": "^0.4.1",
    "passport-google-oauth": "^2.0.0",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-hot-loader": "^4.12.20",
    "redux": "^4.0.5",
    "redux-saga": "^1.1.3",
    "styled-components": "^5.0.1"
  },
  "devDependencies": {
    "@babel/core": "^7.9.0",
    "@babel/preset-react": "^7.9.4",
    "babel-loader": "^8.1.0",
    "clean-webpack-plugin": "^3.0.0",
    "css-loader": "^3.4.2",
    "file-loader": "^6.0.0",
    "html-webpack-plugin": "^4.0.4",
    "jest": "^26.0.1",
    "speed-measure-webpack-plugin": "^1.3.3",
    "style-loader": "^1.1.3",
    "supertest": "^4.0.2",
    "webpack": "^4.42.1",
    "webpack-cli": "^3.3.11",
    "webpack-dev-server": "^3.11.0",
    "webpack-hot-middleware": "^2.25.0"
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Official account of the Timeweb team, 2020-07-17
@timeweb_team

Judging by the forums, the problem can be solved by updating or reinstalling npm. A similar issue has been discussed here:
https://ru.hexlet.io/topics/39650
https://github.com/JeffreyWay/laravel-mix/issues/1198
https://fooobar.com/questions/18376051/error-this -...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question