@hmmmDanone

В чем ошибка при запуске React приложения?

Добрый день! Пытаюсь развернуть на сервере React-приложение, но оно падает с ошибкой. Из логов не могу понять, в чем причина.

> test-task@1.0.0 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! test-task@1.0.0 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 test-task@1.0.0 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


Вот дебаг лог:

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 npm@6.14.6
3 info using node@v12.17.0
4 verbose run-script [ 'predev:unix', 'dev:unix', 'postdev:unix' ]
5 info lifecycle test-task@1.0.0~predev:unix: test-task@1.0.0
6 info lifecycle test-task@1.0.0~dev:unix: test-task@1.0.0
7 verbose lifecycle test-task@1.0.0~dev:unix: unsafe-perm in lifecycle true
8 verbose lifecycle test-task@1.0.0~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 test-task@1.0.0~dev:unix: CWD: /home/oem/projects/test-task
10 silly lifecycle test-task@1.0.0~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 test-task@1.0.0~dev:unix: Returned: code: 2  signal: null
12 info lifecycle test-task@1.0.0~dev:unix: Failed to exec dev:unix script
13 verbose stack Error: test-task@1.0.0 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 test-task@1.0.0
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 test-task@1.0.0 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 test-task@1.0.0 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 ]


Также прикладываю 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"
  }
}
  • Вопрос задан
  • 71 просмотр
Пригласить эксперта
Ответы на вопрос 1
Судя по форумам, проблему может решить обновлением либо переустановкой npm. Похожая проблема обсуждалась здесь:

https://ru.hexlet.io/topics/39650
https://github.com/JeffreyWay/laravel-mix/issues/1198
https://fooobar.com/questions/18376051/error-this-...
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы