2012-07-19 15 views
7

Utilizzando questo comando: npm install jsdom, nel tentativo di ottenere jsdom attivo e in esecuzione da utilizzare con un server node.js, ottengo la seguente serie di errori. Qualcuno potrebbe aiutarmi a chiarire questo problema? Penso che potrebbe esserci anche un problema perché non è possibile installare contextify ... grazie in anticipo!Problema di installazione di JSDOM su 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] 

risposta

14

È necessario GCC per compilare questi moduli node.js.

  1. Vai all'app store e scarica l'ultima versione di Xcode gratuitamente.
  2. Installare Xcode (l'app store in realtà scarica il "installer" per Xcode)
  3. Inizio Xcode
  4. andare in Preferenze
  5. nell'area download
  6. Fare clic sul pulsante "Install" dopo "riga di comando Tools "
  7. Reboot

Done! :)

+0

Huh, penso che questo ha funzionato, tuttavia sto ancora ricevendo un errore nella mia applicazione che sto cercando di implementare. So che questo è fuori dallo scopo di questa domanda e forse ne chiederò un altro, ma hai idea di cosa significhi questo errore? /Users/dereklo/Node/node_modules/jsdom/lib/jsdom.js:171 features = JSON.parse (JSON.stringify (window.document.implementation._fea ^ TypeError: Impossibile leggere la proprietà 'implementazione' di undefined – Apollo

+0

Prova a eseguire il debug e vedi cosa contiene "window.document", non contiene nulla ("undefined"), perché "window.document" è clientide javascript? Non so esattamente cosa stai provando da fare, ma window.document dovrebbe essere usato @ clientide javascript not node.js. – onlineracoon

+0

@Derek Go scarica e installa Python (http://www.python.org/getit/mac/), dopo l'installazione vai al terminale e digita " python "per vedere se si sta innescando, se non si innesca è necessario aggiungere variabili di ambiente per assicurarsi che funzioni. Riavvia, riprova a compilare il modulo Node.js, finito :) – onlineracoon

1

Dopo aver installato XCode Command Line Tools, stavo ancora avendo problemi con npm install jsdom. Si scopre che stavo ancora eseguendo il mio server nodo in modo che l'installazione avrebbe esito negativo. Per chiunque altro incontri questo problema, assicurati di Ctrl + C per fermare il tuo server, quindi fai npm install jsdom. Ha funzionato come un fascino! :)

Problemi correlati