每当我尝试运行npx
和npm
命令时,它们总是返回此错误:
'CALL "C:Program Filesnodejs\node.exe" "C:Program Filesnodejs\node_modulesnpmbinnpm-cli.js" prefix -g' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ENOENT
npm ERR! syscall spawn C:Windowssystem32cmd.exe";c:#python34."
npm ERR! path C:UsersuserDesktopReact-Apps
npm ERR! errno -4058
npm ERR! enoent spawn C:Windowssystem32cmd.exe";c:#python34." ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersuserAppDataLocalnpm-cache_logs2021-11-19T08_56_16_871Z-debug.log
请帮助
在环境变量中设置node.js的路径。为此:
- 右键单击我的电脑->属性->提前系统设置->环境变量->选择&编辑";路径";系统变量中的变量
2(在路径中添加C:Program Filesnodejs;
3( 重新启动命令提示符
4( 在新控制台窗口中键入node --version
,版本号应显示为响应。