Сбой перестройки узла

Я пытаюсь установить приложение nodejs, но я продолжаю получать ту же ошибку о том, что "node-gyp" не удается восстановить.

Я не знаю много о nodejs, кроме того, что я могу заставить это нормально работать на моей локальной машине, но я не могу понять, почему он не будет работать на сервере.

Ubuntu 14.04 Node v0.12.5 npm v2.11.2

> ws@0.4.32 install /root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory `/root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
make: Leaving directory `/root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'

> ref@1.0.2 install /root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref
> node-gyp rebuild

make: Entering directory `/root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref/build'
  CXX(target) Release/obj.target/binding/src/binding.o
make: g++: Command not found
make: *** [Release/obj.target/binding/src/binding.o] Error 127
make: Leaving directory `/root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.13.0-52-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref
gyp ERR! node -v v0.12.5
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok 
npm ERR! Linux 3.13.0-52-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.5
npm ERR! npm  v2.11.2
npm ERR! code ELIFECYCLE

npm ERR! ref@1.0.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ref@1.0.2 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the ref 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 ref
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/banquo-server/npm-debug.log

Любая помощь высоко ценится.

С уважением

Люк

4 ответа

Кажется, у вас есть конфликт со старым пакетом, который мешает.

Попробуйте приведенные ниже команды, которые помогли мне решить проблему, могут помочь и вам... этим командам может потребоваться доступ sudo

npm cache clean -f
npm install -g n
n stable
npm install npm -g

Таким образом, выше решает проблему, когда есть конфликт в версии пакетов.... но, глядя на журналы, он говорит make: g++: Command not found Это означает, что вам нужно установить инструменты разработчика

Вы пытались установить node-gyp через apt-get install:

apt-get install node-gyp

Команда g++ не найдена, поэтому вам необходимо установить пакет g++ (вместе с build-essential, который включает в себя другие пакеты, необходимые для сборки / компиляции программ):

sudo apt-get install build-essential g++

yarn installисправил это для меня, надеюсь, это поможет

Другие вопросы по тегам