使用此命令:npm install jsdom,试图让jsdom启动并运行以与node.js服务器一起使用,我得到以下一系列错误。有人可以帮助澄清这个问题吗?我认为可能还有一个问题,因为它无法安装contextify ......先谢谢了!在mac上安装JSDOM问题
npm http GET https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/htmlparser
npm http GET https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/htmlparser
npm WARN package.json [email protected] No README.md file found!
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings
> [email protected] install /Users/dereklo/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild
gyp ERR! rebuild error Error: not found: make
gyp ERR! rebuild error at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:43:28)
gyp ERR! rebuild error at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:46:29)
gyp ERR! rebuild error at /usr/local/lib/node_modules/npm/node_modules/which/which.js:57:16
gyp ERR! rebuild error at Object.oncomplete (fs.js:297:15)
gyp ERR! not ok
npm WARN optional dep failed, continuing [email protected]
[email protected] node_modules/jsdom
├── [email protected]
└── [email protected]
嗯,我认为这工作,但我仍然收到我尝试实施的应用程序中的错误。我知道这个问题超出了这个问题的范围,也许我会问另一个问题,但是你知道这个错误是什么意思吗? /Users/dereklo/Node/node_modules/jsdom/lib/jsdom.js:171 features = JSON.parse(JSON.stringify(window.document.implementation._fea ^ TypeError:无法读取undefined的属性'implementation' – Apollo 2012-07-21 16:37:56
尝试调试并查看“window.document”包含的内容,它根本不包含任何内容(“undefined”),这是因为“window.document”是客户端JavaScript?我不确切地知道你在尝试什么但window.document应该使用@ clientside javascript不是node.js. – onlineracoon 2012-07-21 16:48:26
@Derek Go下载并安装Python(http://www.python.org/getit/mac/),安装完成后进入终端并输入“ python“来查看它是否触发,如果没有触发,则需要添加环境变量以确保其正常工作。重新启动,重试以编译Node.js模块,完成:) – onlineracoon 2012-07-21 16:53:26