简体   繁体   中英

Why won't npm i complete the install? Why is it telling node and npm are invalid commands?

Trying to run a React project. I have installed the most recent node as well as tried older versions based on the readme. I've uninstalled Node, cleared all traces of it from APPDATA/ROAMING and ProgramFiles then reinstalled. Colleagues have various versions of Node and npm on their machines and are able to run the project locally. I have checked my environment variables and made sure the PATH properties are set correctly. I have removed this particular package from the JSON file and retried and see similar issues. Node and npm are clearly installed. Anyone ever faced this situation or have suggestions to try? I've been working at this for days. Thanks.

PS C:\dev\NAE\become-react-app> node --version
v14.16.0
PS C:\dev\NAE\become-react-app> npm -v
6.14.11
PS C:\dev\NAE\become-react-app> npm i

> @newrelic/native-metrics@5.0.0 install C:\dev\NAE\become-react-app\node_modules\@newrelic\native-metrics
> node ./lib/pre-build.js install native_metrics

'node' is not recognized as an internal or external command,
operable program or batch file.

> husky@4.2.3 install C:\dev\NAE\become-react-app\node_modules\husky
> node husky install

'node' is not recognized as an internal or external command,
operable program or batch file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\react-scripts\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\react-scripts\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\nodemon\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @newrelic/native-metrics@5.0.0 (node_modules\@newrelic\native-metrics):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @newrelic/native-metrics@5.0.0 install: `node ./lib/pre-build.js install native_metrics`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! husky@4.2.3 install: `node husky install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the husky@4.2.3 install 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\ngmoscho\AppData\Roaming\npm-cache\_logs\2021-03-18T21_32_55_714Z-debug.log
PS C:\dev\NAE\become-react-app> npm run start:local

> become-react-app@1.1.0 prestart:local C:\dev\NAE\become-react-app
> npm run makeLocalEnv

'npm' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! become-react-app@1.1.0 prestart:local: `npm run makeLocalEnv`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the become-react-app@1.1.0 prestart:local 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\ngmoscho\AppData\Roaming\npm-cache\_logs\2021-03-18T22_08_46_897Z-debug.log

I would try to reinstall Node again!

I had it once where it seemed to be installed, but wasn't when executing a command. Just like you. Even after reinstalling npm and node, the result was the same. I rebooted my computer and that fixed the problem for me. Pretty lame solution, took me a while to find out.

Hope this helps for you too.

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