我正在使用Windows 8.1 64位,并且使用nodejs.org的Windows Installer安装npm。每次输入npm命令时,它总是显示以下消息: 'CALL“C:\ Program Files \ nodejs \ node.exe”“C:\ Program Files \ nodejs \ node_modules \ npm \ bin \ npm-cli.js”前缀-g'不被识别为内部或外部命令,可操作程序或批处理文件。npm命令返回消息-g'不被识别为内部或外部命令
Error while running npm “prefix -g is not recognized as an internal or external command”没有解决我的问题
节点-v
v6.10.0
NPM -v
“CALL“C:\程序文件s \ nodejs \ node.exe“”C:\ Program Files \ nodejs \ node_modules \ npm \ bin \ npm-cli.js“前缀-g”不是 被识别为内部或外部命令,可操作程序或批次为 文件。
3.10.10
NPM配置获取注册表
“CALL “C:\ Program Files文件\的NodeJS \ node.exe”“C:\ PROGRAM 文件\的NodeJS \ node_modules \ npm \ bin \ npm-cli.js“前缀-g”不是 被识别为内部或外部命令,可操作程序或 批处理文件。
对不起,我是nodejs中的新成员。我在我的项目文件夹中有.env文件,但没有指向nodejs路径的var。我把它们放到我的.env文件中? – Patriot
我的意思是你的Windows环境变量。有关如何在Windows中设置路径的信息,请转到“Windows Isntallation”:https://www.tutorialspoint.com/nodejs/nodejs_environment_setup.htm,网址为:http://www.computerhope.com/issues/ch000549.htm – TanguyB
[https://www.tutorialspoint.com/nodejs/nodejs_environment_setup.htm](https://www.tutorialspoint.com/nodejs/nodejs_environment_setup.htm)仍然出现错误,C:\ Program Files \ nodejs \ bin不是存在于我的目录 – Patriot