【问题标题】:Getting "node is not recognized as an internal or external command" when using npm install expo使用 npm install expo 时获取“节点未被识别为内部或外部命令”
【发布时间】:2020-10-24 01:04:43
【问题描述】:

我正在尝试在卸载后使用 npm install -g expo-cli 安装 expo cli 但我收到以下错误:

> @expo/traveling-fastlane-linux@1.15.1 preinstall C:\Users\owl\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\traveling-fastlane-linux
> node platform.js

'node' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\owl\AppData\Roaming\npm\expo -> C:\Users\owl\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js
C:\Users\owl\AppData\Roaming\npm\expo-cli -> C:\Users\owl\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js

> core-js@2.6.11 postinstall C:\Users\owl\AppData\Roaming\npm\node_modules\expo-cli\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

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

....

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! core-js@2.6.11 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the core-js@2.6.11 postinstall 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\owl\AppData\Roaming\npm-cache\_logs\2020-07-03T09_59_16_882Z-debug.log


以前安装npm包没问题,不知道是不是我不小心删除了一些文件

  • nodejs 已经添加到环境变量的路径中
  • 我尝试重新安装 npm 和 nodejs,清除 npm 缓存,重新启动,但似乎没有任何效果:(
$ npm --version
6.14.5 
$ node --version
v12.18.2

有什么建议吗?
谢谢

更新:以管理员身份启动终端并再次运行命令解决了问题:)

【问题讨论】:

标签: node.js npm expo


【解决方案1】:

对于可能遇到类似问题的任何人,请尝试在以管理员身份使用终端时运行该命令

【讨论】:

    猜你喜欢
    • 2020-04-19
    • 2019-03-14
    • 1970-01-01
    • 2018-10-19
    • 2018-07-13
    • 1970-01-01
    • 2019-06-28
    • 2016-11-29
    • 1970-01-01
    相关资源
    最近更新 更多