簡體   English   中英

為什么 npm 我無法完成安裝? 為什么它告訴節點和 npm 是無效命令?

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

試圖運行一個 React 項目。 我已經安裝了最新的節點,並根據自述文件嘗試了舊版本。 我已經卸載了 Node,從 APPDATA/ROAMING 和 ProgramFiles 中清除了它的所有痕跡,然后重新安裝。 同事機器上有各種版本的Node和npm,可以在本地運行項目。 我檢查了我的環境變量並確保正確設置了 PATH 屬性。 我已經從 JSON 文件中刪除了這個特定的 package 並重試並看到類似的問題。 節點和 npm 安裝清晰。 有人遇到過這種情況或有嘗試的建議嗎? 我已經為此工作了好幾天。 謝謝。

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

我會嘗試再次重新安裝 Node!

我曾經在它似乎安裝的地方安裝過它,但在執行命令時卻沒有。 就像你一樣。 即使重新安裝npm和node,結果還是一樣。 我重新啟動了計算機,這為我解決了問題。 相當蹩腳的解決方案,我花了一段時間才發現。

希望這對你也有幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM