Sử dụng lệnh này: npm install jsdom, trong nỗ lực để chạy jsdom và chạy để sử dụng với máy chủ node.js, tôi nhận được chuỗi lỗi sau. Ai đó có thể vui lòng giúp làm rõ vấn đề này? Tôi nghĩ rằng cũng có thể có một vấn đề bởi vì nó không thể cài đặt contextify ... cảm ơn trước!Sự cố khi cài đặt JSDOM trên máy mac
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]
Huh, tôi nghĩ rằng điều này làm việc, tuy nhiên tôi vẫn nhận được một lỗi trong ứng dụng của tôi mà tôi đang cố gắng thực hiện. Tôi biết điều này nằm ngoài phạm vi của câu hỏi này và có lẽ tôi sẽ hỏi một câu hỏi khác, nhưng bạn có biết ý nghĩa của lỗi này không? /Users/dereklo/Node/node_modules/jsdom/lib/jsdom.js:171 features = JSON.parse (JSON.stringify (window.document.implementation._fea ^ LoạiError: Không thể đọc thuộc tính 'implementation' của undefined – Apollo
Cố gắng để gỡ lỗi và xem những gì "window.document" có chứa, nó không chứa bất cứ điều gì cả ("undefined"), điều này là bởi vì "window.document" là clientside javascript? Tôi không biết chính xác những gì bạn đang cố gắng để làm nhưng window.document nên được sử dụng @ clientside javascript không node.js. – onlineracoon
@Derek Go tải xuống và cài đặt Python (http://www.python.org/getit/mac/), sau khi cài đặt, hãy vào terminal và gõ " python "để xem nếu nó đang kích hoạt, nếu nó không kích hoạt, bạn cần phải thêm các biến môi trường để đảm bảo rằng nó đang hoạt động. Khởi động lại, thử lại để biên dịch mô-đun Node.js, đã hoàn thành :) – onlineracoon