简体   繁体   English

npm start 不工作 - 包/反应脚本问题

[英]npm start not working - issue with package/react script

For one of my react app, 'npm start' is not working.对于我的一个反应应用程序,'npm start' 不起作用。 For other react apps, npm start works well but for this particular project it does not work.对于其他 React 应用程序,npm start 运行良好,但对于这个特定项目,它不起作用。 I get the following error:我收到以下错误:

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.9.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! c-client@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the c-client@0.1.0 start script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the c-client package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs c-client
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls c-client
npm ERR! There is likely additional logging output above.

NPM-debug log NPM-调试日志

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using npm@3.10.10
3 info using node@v6.9.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle c-client@0.1.0~prestart: c-client@0.1.0
6 silly lifecycle c-client@0.1.0~prestart: no script for prestart, continuing
7 info lifecycle c-client@0.1.0~start: c-client@0.1.0
8 verbose lifecycle c-client@0.1.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle c-client@0.1.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\project1\client\node_modules\.bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files (x86)\PharosSystems\Core;C:\Users\sophi\Anaconda3;C:\Users\sophi\Anaconda3\Scripts;C:\Users\sophi\Anaconda3\Library\bin;C:\Users\sophi\AppData\Local\Microsoft\WindowsApps;C:\Users\sophi\AppData\Local\atom\bin;C:\Users\sophi\AppData\Roaming\npm
10 verbose lifecycle c-client@0.1.0~start: CWD: C:\project1\client
11 silly lifecycle c-client@0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
12 silly lifecycle c-client@0.1.0~start: Returned: code: 1  signal: null
13 info lifecycle c-client@0.1.0~start: Failed to exec start script
14 verbose stack Error: c-client@0.1.0 start: `react-scripts start`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:877:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid c-client@0.1.0
16 verbose cwd C:\project1\client
17 error Windows_NT 10.0.14393
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
19 error node v6.9.4
20 error npm  v3.10.10
21 error code ELIFECYCLE
22 error c-client@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the c-client@0.1.0 start script 'react-scripts start'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the c-client package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     react-scripts start
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs c-client
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls c-client
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Anyone has an idea on how to solve this please?任何人都知道如何解决这个问题?

Package.json file : Package.json 文件:

{
  "name": "c-client",
  "version": "0.1.0",
  "private": true,
  "proxy": "http://localhost:3001/",
  "devDependencies": {
    "react-scripts": "0.8.5"
  },
  "dependencies": {
    "lodash": "^4.17.4",
    "react": "^15.4.2",
    "react-dom": "^15.4.2",
    "react-gesture": "0.0.2-rc.12",
    "react-swipeable": "^3.9.1",
    "react-touch": "^0.4.0",
    "react-touch-events": "^2.0.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

I had a similar problem after I restarted me computer.重新启动计算机后,我遇到了类似的问题。 It was working just fine before I turned it off!... I tried for hours but in the end, in the terminal, I typed 'ls' and realised that I was in the file above the React app that I was trying to 'npm start'.在我关闭它之前它工作得很好!...我尝试了几个小时,但最后,在终端中,我输入了“ls”并意识到我在 React 应用程序上方的文件中,我正在尝试“ npm 开始'。 I'm not presuming this might be everyone's issue, but sometimes, it's the simplest oversight.我不认为这可能是每个人的问题,但有时,这是最简单的疏忽。 Hope this helps someone.希望这可以帮助某人。 R电阻

是的,我遇到了同样的问题,但是在使用“ls”查看目录后意识到我在错误的文件夹而不是实际文件夹中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM