每当我尝试运行npm install
或npm start
时,都会出现此错误:
bash: line 0: cd: packages/react-scripts: No such file or directory
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! aristophanes@1.0.0 start: `cd packages/react-scripts && node bin/react-scripts.js start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aristophanes@1.0.0 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! C:\Users\Aristophanes\AppData\Roaming\npm-cache\_logs\2018-11-09T12_14_19_704Z-debug.log
我不知道为什么要开始使用它。谁能阐明一些想法?我尝试再次卸载并安装,但没有帮助。另外,我不知道为什么,但是 node.js 在我的计算机上安装了2个node_modules
文件夹-一个在我的C://Program Files/nodejs/
目录中,另一个在C://Users/Aristophanes/
中。每个文件中的两个 package.json 文件是不同的。
错误日志:
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@6.4.1
3 info using node@v10.13.0
4 verbose config Skipping project config: C:\Users\Aristophanes/.npmrc. (matches userconfig)
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info lifecycle aristophanes@1.0.0~prestart: aristophanes@1.0.0
7 info lifecycle aristophanes@1.0.0~start: aristophanes@1.0.0
8 verbose lifecycle aristophanes@1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle aristophanes@1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Aristophanes\node_modules\.bin;C:\Program Files\cmder\bin;C:\Program Files\cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\Program Files\cmder\vendor\conemu-maximus5;C:\Program Files\cmder\vendor\conemu-maximus5\ConEmu;C:\Program Files\nodejs;C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Boxstarter;C:\Program Files\Microsoft MPI\Bin\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Go\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Users\Aristophanes\Go\bin;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\Aristophanes\AppData\Local\Programs\Python\Python37;C:\Users\Aristophanes\AppData\Local\Programs\Python\Python37\Scripts;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\PHP;C:\ProgramData\chocolatey\bin;C:\Program Files\Geth;C:\HashiCorp\Vagrant\bin;C:\Program Files\Git\cmd;C:\composer;C:\Users\Aristophanes\AppData\Roaming\npm;C:\Program Files\nodejs\;C:\Users\Aristophanes\AppData\Roaming\local\bin;C:\Users\Aristophanes\AppData\Local\Microsoft\WindowsApps;C:\Users\Aristophanes\AppData\Local\atom\bin;C:\Users\Aristophanes\AppData\Local\Microsoft\WindowsApps;C:\Users\Aristophanes\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Aristophanes\AppData\Local\GitHubDesktop\bin;C:\Users\Aristophanes\AppData\Roaming\Composer\vendor\bin;C:\Program Files\nodejs\bin;C:\Users\Aristophanes\AppData\Roaming\npm;C:\Program Files\Git\mingw64;C:\Program Files\Git\usr\bin;C:\Program Files\cmder
10 verbose lifecycle aristophanes@1.0.0~start: CWD: C:\Users\Aristophanes
11 silly lifecycle aristophanes@1.0.0~start: Args: [ '-c',
11 silly lifecycle 'cd packages/react-scripts && node bin/react-scripts.js start' ]
12 silly lifecycle aristophanes@1.0.0~start: Returned: code: 1 signal: null
13 info lifecycle aristophanes@1.0.0~start: Failed to exec start script
14 verbose stack Error: aristophanes@1.0.0 start: `cd packages/react-scripts && node bin/react-scripts.js start`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
14 verbose stack at EventEmitter.emit (events.js:182:13)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
14 verbose stack at ChildProcess.emit (events.js:182:13)
14 verbose stack at maybeClose (internal/child_process.js:962:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
15 verbose pkgid aristophanes@1.0.0
16 verbose cwd C:\Users\Aristophanes
17 verbose Windows_NT 10.0.17134
18 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
19 verbose node v10.13.0
20 verbose npm v6.4.1
21 error code ELIFECYCLE
22 error errno 1
23 error aristophanes@1.0.0 start: `cd packages/react-scripts && node bin/react-scripts.js start`
23 error Exit status 1
24 error Failed at the aristophanes@1.0.0 start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
答案 0 :(得分:1)
C:// Program Files / nodejs中的一个是您正在安装的全局软件包。
项目中的一个是项目的依赖项。
此问题可能是由于您在没有package.json的文件夹上运行npm install而引起的。