npm在Windows上安装jsdom错误?
我在我的Windows PC上安装了nodejs。 它工作正常。 但是当我试图用“npm install jsdom”来安装jsdom时,我被这个错误提示了。
节点“C:\ Program Files \ nodejs \ node_modules \ npm \ bin \ node-gyp-bin \ …. \ node_modules \ node-gyp \ bin \ node-gyp.js”重build信息如果以ok
呃! 错误:Python似乎没有安装
在C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \下运行failNoPython(C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ lib \ configure.js:78:14) node-gyp \ lib \ configure.js:66:11)ERR! 不好
npm WARN可选依赖失败,继续contextify@0.1.2
jsdom@0.2.13 ./node_modules/jsdom
+ – cssom@0.2.3 + – htmlparser@1.7.5
任何人都可以帮我解决这个问题吗?
我在Windows 7(x64旗舰版)上遇到了同样的问题,经过几个小时的search和试用,我就是这样解决的。 请按照相同的顺序执行以下步骤:
- 安装Visual Studio 2010/2012 C ++(Express或更高版本)
- 安装Windows SDK 7.1
- 为Windows SDK 7.1安装“Microsoft Visual C ++ 2010 Service Pack 1编译器更新”
- 安装GTK(C:\ GTK)
- 安装Python(C:\ Python27)
- 安装node.js(x86)
- 将[node.js]添加到path(C:\ Program Files(x86)\ nodejs \;)
- 将[python]添加到path(C:\ Python27 \;)
- 将[GTK]添加到path(C:\ GTK \ bin;)
- 添加指向“C:\ Program Files \ Microsoft SDKs \ Windows \ v7.1 \ Bin”的[WindowsSDKDir]系统variables
- 以pipe理员身份运行“Windows SDK 7.1命令提示符”
- 使用“setenv / x86”将环境设置为x86
- 将目录更改为“C:\ Program Files(x86)\ nodejs \”
- 运行“npm install -g npm”
- 运行“npm update -g npm”
- 运行“npm install -g node-gyp”
- 运行“node-gyp configure build”
- 运行“npm install jsdom”
- 运行“npm install ajax”
- 运行“npm install http-server”
- 运行“npm install jquery”
- 运行“npm install xmlhttprequest”
- 运行“npm update”
我希望这有帮助。
有一个很好的指导,让JSDom在Windows上工作: http : //www.steveworkman.com/node-js/2012/installing-jsdom-on-windows/
jsdom依赖于symxtify,它最近才支持windows。 你需要python和一个C ++编译器来安装它。
您可能还需要执行以下操作
npm install -g node-gyp node-gyp configure
对于Windows 8 64位,安装zmq和protobuf,以下为我工作:
首先,安装Visual Studio 2012
然后,在命令提示符(在您的项目目录中):
SET VisualStudioVersion=11.0 npm install zmq npm install protobuf npm install jsdom
jsdom
使用contextify
在DOM上运行JavaScript。 而且contextify
需要本地的C ++编译器。 根据官方自述 ,在Windows平台上,必须安装:
- 用于Windows的x86版本的Node.js的最新副本,而不是x64版本。 (应该没问题)
- Visual C ++ 2010 Express的副本。 (或更新的版本)
- Python 2.7的副本,安装在
C:\Python27
的默认位置。
如果您已经安装了python,则需要将python安装目录添加到PATH环境variables中。
假设python.exe位于C:\Python32\
目录下,在DOS提示符下,您需要键入:
set PATH=%PATH%;C:\Python32\;
接着:
node-gyp configure
应该工作正常,没有这个错误。
经过近半年的解决这个问题,阅读所有与此有关的论坛,我终于find了解决办法。
我所做的事情很简单,因为我没有在这台电脑上使用很多应用程序。
我的Windows 8.1有很多程序安装,可能会混淆NodeJS(框架,VS插件等)。
所以我只是这样做了:
- 从MS删除了所有程序,我安装了一次。
- 卸载Nodejs
- 当然,我用CCleaner清理了registry
- 删除了与Node.js相关的Python,Node-gyp和其他应用程序
然后我重新安装了Node.js,对于正确安装的JSdom感到乐观,但是在运行我的项目时崩溃了。 所以我search了新的错误 – 再次 – 有一个简单的解决scheme。 我不得不安装JSdom的旧版本。
npm install jsdom@4.2.0
最后,一切正常。 希望能帮助任何人解决这个问题。