简体   繁体   中英

Getting “node is not recognized as an internal or external command” when using npm install expo

I'm trying to install expo cli using npm install -g expo-cli after uninstalling it but I'm getting the following error:

> @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


I used to have no issues installing npm packages, I don't know if I accidentally deleted some files

  • the nodejs has already been added to the path in the environment variables
  • I've tried re-installing npm and nodejs, clearing npm cache, restarting but nothing seems to be working:(
$ npm --version
6.14.5 
$ node --version
v12.18.2

Any suggestions?
Thank you

Update: Starting the terminal as an admin and running the command again solved the problem:)

For anyone who could be facing a similar problem, try running the command while using the terminal as an admin

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