Я 1 час в NodeJS, так что терпите меня. Один из пакетов, который требуется моему проекту, — это JSDom. Изучив большую часть Интернета, я обнаружил, что JSDOm имеет зависимость, называемую contextify, которая каким-то образом обрабатывается в самой установке JSDom. Итак, что я делаю:
sudo npm install jsdom
и все идет нормально, пока я не получаю следующее:
gyp WARN install got an error, rolling back install
gyp ERR! rebuild error Error: EACCES, stat '/root/.node-gyp/0.8.2'
gyp ERR! not ok
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the contextify 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 contextify
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.2.0-60-generic
npm ERR! command "/opt/node/bin/node" "/opt/node/bin/npm" "install" "contextify"
npm ERR! cwd /opt/node
npm ERR! node -v v0.8.2
npm ERR! npm -v 1.1.36
npm ERR! code ELIFECYCLE
npm ERR! message [email protected] install: `node-gyp rebuild`
npm ERR! message `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /opt/node/npm-debug.log
npm ERR! not ok code 0
ЗАДУМАН!!!
Я обнаружил, что для запуска contextify в Ubuntu у меня должны быть make, python и G++. У меня есть все. Итак, что именно я здесь упускаю?
К вашему сведению, команды, предшествующие попытке установки JSDOM:
mkdir ~/.node-gyp
chmod -R 777 ~/.node-gyp
Я также пробовал следующее:
npm install -g node-gyp
npm install contextify
При второй команде я сталкиваюсь с той же проблемой.
sudo npm install -g npm
и повторить попытку (это сработало на моем Mac) или посмотреть это stackoverflow.com/questions/21148917/. если вы сделали стандартный apt-get на узле, это может быть отстало от времени, и использование последней версии пакета может исправить это. - person KeepCalmAndCarryOn   schedule 09.04.2014