在Windows上运行Python以获取Node.js依赖项我正在进入Node.js代码库,这需要我通过NPM下载一些依赖项,即jQuery。在尝试运行时npm install jquery,我不断收到此错误:Your environment has been set up for using Node.js 0.8.21 (x64) and NPM
C:\Users\Matt Cashatt>npm install jquery
npm http GET https://registry.npmjs.org/jquerynpm http 304 https://registry.npmjs.org/jquerynpm http GET https://registry.npmjs.org/jsdomnpm http GET https://registry.npmjs.org/xmlhttprequestnpm http GET https://registry.npmjs.org/htmlparser/1.7.6npm http GET https://registry.npmjs.org/location/0.0.1npm http GET https://registry.npmjs.org/navigatornpm http GET https://registry.npmjs.org/contextifynpm http 304 https://registry.npmjs.org/htmlparser/1.7.6npm http 304 https://registry.npmjs.org/xmlhttprequestnpm http 304 https://registry.npmjs.org/location/0.0.1npm http 304 https://registry.npmjs.org/navigatornpm http 304 https://registry.npmjs.org/jsdomnpm http 304 https://registry.npmjs.org/contextifynpm http GET https://registry.npmjs.org/bindingsnpm http GET https://registry.npmjs.org/cssomnpm http GET https://registry.npmjs.org/cssstylenpm http GET https://registry.npmjs.org/requestnpm http 304 https://registry.npmjs.org/bindings> contextify@0.1.4 install C:\Users\Matt Cashatt\node_modules\jquery\node_module
s\contextify> node-gyp rebuild
C:\Users\Matt Cashatt\node_modules\jquery\node_modules\contextify>node "C:\Progr
am Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\b
in\node-gyp.js" rebuild
npm http 304 https://registry.npmjs.org/cssstylenpm http 304 https://registry.npmjs.org/cssomnpm http 304 https://registry.npmjs.org/requestgyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\nod看起来失败是由于缺少Python安装。好吧,我已经安装了Python,设置了变量,然后重新启动并仍然出错。关于我缺少什么的任何线索?
3 回答
汪汪一只猫
TA贡献1898条经验 获得超8个赞
我在尝试安装node-sass@4.9.4时遇到了同样的挑战。
在查看了当前的官方文档并阅读了上述答案后,我注意到您可能不一定要安装node-gyp,也不必安装windows-build工具。这就是它所说的,关于在Windows上安装node-gyp。请记住node-gyp涉及node-sass的安装过程。而你真的不必重新安装另一个python版本。
这是救世主,在安装任何需要构建工具的软件包时,配置“npm”应该查找的python路径。
C:\> npm config set python /Python36/python
我在windows-7上安装了python3.6.3。
小唯快跑啊
TA贡献1863条经验 获得超2个赞
对我来说,这些步骤解决了这个问题:
1-以管理员身份运行此cmd:
npm install --global --production windows-build-tools
2-然后npm rebuild
在第1步完成后运行(特别是完成python 2.7安装,这是问题的主要原因)
添加回答
举报
0/150
提交
取消