Ошибка при попытке установить пакет npm «libxmljs»

Я получаю следующее сообщение об ошибке, когда пытаюсь установить пакет libxmljs npm.

$ sudo npm install -g libxmljs
npm http GET https://registry.npmjs.org/libxmljs
npm http 200 https://registry.npmjs.org/libxmljs
npm http GET https://registry.npmjs.org/bindings/1.0.0
npm http 200 https://registry.npmjs.org/bindings/1.0.0
npm http GET https://registry.npmjs.org/bindings/-/bindings-1.0.0.tgz
npm http 200 https://registry.npmjs.org/bindings/-/bindings-1.0.0.tgz

> [email protected] install /usr/lib/node_modules/libxmljs
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/support/.node-gyp/0.10.23"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/libxmljs/.node-gyp"
gyp http GET http://nodejs.org/dist/v0.10.23/node-v0.10.23.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.23/node-v0.10.23.tar.gz
make: Entering directory `/usr/lib/node_modules/libxmljs/build'
  CC(target) Release/obj.target/libxml/vendor/libxml/buf.o
make: cc: Command not found
make: *** [Release/obj.target/libxml/vendor/libxml/buf.o] Error 127
make: Leaving directory `/usr/lib/node_modules/libxmljs/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.11.0-15-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/libxmljs
gyp ERR! node -v v0.10.23
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok 
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the libxmljs 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 libxmljs
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.11.0-15-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "libxmljs"
npm ERR! cwd /
npm ERR! node -v v0.10.23
npm ERR! npm -v 1.3.17
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /npm-debug.log
npm ERR! not ok code 0

В моей системе установлен node-gyp версии 0.12.1, что является обязательным условием для libxmljs. Версия узла v0.10.23.

Может ли кто-нибудь помочь мне в решении проблемы.


person shaunthomas999    schedule 18.12.2013    source источник
comment
make: cc: Command not found Попробуйте sudo apt-get install gcc   -  person Eraden    schedule 18.12.2013
comment
Этот вопрос не здесь.   -  person melancia    schedule 18.12.2013
comment
Не могли бы вы отследить, где он ломается, используя команду sudo npm install -g libxmljs --verbose   -  person Pravin Mishra    schedule 18.12.2013


Ответы (3)


Как сказал Эраден, проблема была в make: cc: Command not found. sudo apt-get install gcc решил проблему.

person shaunthomas999    schedule 21.12.2013
comment
Большое спасибо! Я добавил свой собственный ответ, так как мне нужно было установить другой пакет. - person Germán Carrillo; 20.05.2016

Похоже, ваш системный узел и npm не обновлены.

Используйте NVM (диспетчер версий узлов) для запуска нескольких узлов.

person Pravin Mishra    schedule 18.12.2013

Просто для справки, в моем случае на Centos 7 мне также пришлось установить gcc-c++:

sudo yum install gcc gcc-c++.x86_64

Только так я смог установить libxmljs.

person Germán Carrillo    schedule 19.05.2016