win7 64位下安装nodejs 的jquery@1.6.3时无法安装依赖包jsdom的解决办法

jsdom又依赖于contextify,而contextify又需要gyp来重新编译,安装过程中老是报错,如下:

gyp ERR! configure error
gyp ERR! stack Error: spawn ENOENT
gyp ERR! stack     at errnoException (child_process.js:980:11)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:771:34)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "D:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\nodejs\node_modules\contextify
gyp ERR! node -v v0.10.22
gyp ERR! node-gyp -v v0.11.0
gyp ERR! not ok
npm ERR! contextify@0.1.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify@0.1.7 install script.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls contextify
npm ERR! There is likely additional logging output above.


npm ERR! System Windows_NT 6.1.7601
npm ERR! command "D:\\nodejs\\\\node.exe" "D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "contextify"
npm ERR! cwd D:\nodejs
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     D:\nodejs\npm-debug.log
npm ERR! not ok code 0


所以我就放弃这种安装方式了,直接找了一个win64下的二进制包:

https://github.com/youxiachai/nodeWinBinary

拷贝到node_modules下,再安装jquery@1.6.3时就对了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: 要在Node.js中安装jsdom模块,你可以使用npm安装。首先,确保你已经安装了Node.js和npm。然后,在命令行中运行以下命令来安装jsdom模块: ``` npm install jsdom ``` 这将会在你的项目中安装jsdom模块。安装完成后,你可以在你的代码中引入jsdom模块,并使用它来模拟DOM环境。你可以使用`JSDOM`类来创建一个DOM实例,传入一个含HTML代码的字符串作为参数。例如,你可以这样创建一个含一个`<p>`元素的DOM实例: ```javascript const { JSDOM } = require('jsdom'); const html = '<p>Hello world</p>'; const dom = new JSDOM(html); console.log(dom.window.document.querySelector('p').textContent); ``` 这将会输出 "Hello world"。希望这能帮到你!\[1\]\[2\] #### 引用[.reference_title] - *1* *2* [使用 jsdom 模块在 Node.js 中模拟 DOM 环境](https://blog.csdn.net/gaoxiangfei/article/details/130902473)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [nodejsjsdom安装](https://blog.csdn.net/xiaocie3456/article/details/18351011)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值