简体   繁体   中英

After switching from one react project to another npm start throws error: The system cannot find the path specified. npm ERR! code ELIFECYCLE

Hey guys figured this place would most likely be able to help me. So i have 2 react projects project A and project B

Whenever i run project B and then finish and try to run project A( npm start ) i get error react-scripts error.

Also it only happens to project A, project B can be re run as many times as i want with no error.

I get following error:

$ npm start

> react-only-template@0.1.0 start E:\projects\project-a
> react-scripts start

The system cannot find the path specified.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-only-template@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-only-template@0.1.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:

Log file:

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.14.11
3 info using node@v10.24.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle react-only-template@0.1.0~prestart: react-only-template@0.1.0
6 info lifecycle react-only-template@0.1.0~start: react-only-template@0.1.0
7 verbose lifecycle react-only-template@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle react-only-template@0.1.0~start: PATH: C:\Users\neman\AppData\Roaming\nvm\v10.24.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\projects\project-a\node_modules\.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\neman\bin;C:\Users\neman\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\neman\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Program Files\Microsoft VS Code\bin;C:\ProgramData\ComposerSetup\bin;E:\xampp\php;E:\php-7.4.7;E:\Vagrant\bin;%NVM_HOME%;%NVM_SYMLINK%;C:\ProgramData\chocolatey\bin;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\neman\AppData\Local\Microsoft\WindowsApps;C:\Users\neman\AppData\Roaming\Composer\vendor\bin;C:\Users\neman\AppData\Roaming\npm;C:\Users\neman\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
9 verbose lifecycle react-only-template@0.1.0~start: CWD: E:\projects\project-a
10 silly lifecycle react-only-template@0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle react-only-template@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle react-only-template@0.1.0~start: Failed to exec start script
13 verbose stack Error: react-only-template@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\neman\AppData\Roaming\nvm\v10.24.0\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\neman\AppData\Roaming\nvm\v10.24.0\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid react-only-template@0.1.0
15 verbose cwd E:\projects\project-a
16 verbose Windows_NT 10.0.19042
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v10.24.0
19 verbose npm  v6.14.11
20 error code ELIFECYCLE
21 error errno 1
22 error react-only-template@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the react-only-template@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

node version 10.24.0 npm: 6.14.11

Also react scripts are not installed globally!

project A: Is CRA app

"react": "^17.0.1",
"react-scripts": "^4.0.0",

Project B: Is also CRA app

"react": "^16.13.1",
"react-scripts": "^3.4.3",

Only way I can run project A again is if I restart my PC which is really really panful as I have to re-run docker and a lot of other apps. I would appreciate anyone who has any suggestions on how to solve this permanently or at least make it so I don't have to restart my computer

This things happens. Have you tried deleting node_moduled, package-lock.json and run this command? npm cache clean --force

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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