Question

I am 1 hour into NodeJS, so bear with me. One of the packages my project requires is JSDom. After prodding much of the Internet I found that JSDOm has a dependency called contextify, which is somehow handled within the JSDom installation in itself. So this is what I Do:

sudo npm install jsdom 

and everything goes fine, until I get the following:

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! contextify@0.1.7 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the contextify@0.1.7 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 contextify@0.1.7 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

STUMPED!!!

I found that for contextify to run on Ubuntu, I must have make, python and G++. I have them all. So what exactly am I missing out here?

FYI, the commands preceding the JSDOM install attempt are:

mkdir ~/.node-gyp
chmod -R 777 ~/.node-gyp

I also, tried the following:

npm install -g node-gyp
npm install contextify

At the second command, I run into the same problem.

Was it helpful?

Solution

you might need to do

sudo npm install -g npm

and try again (it worked on my mac)

or see this Error installing contextify- node-gyp rebuild failed

if you did a standard apt-get on node it could well be behind the times and taking the latest bundle release might fix it

OTHER TIPS

The situation has changed: jsdom >= 4.0.0 no longer uses contextify:

4.0.0

This release relies on the newly-overhauled vm module of io.js to eliminate the Contextify native module dependency. jsdom should now be much easier to use and install, without requiring a C++ compiler toolchain!

And if you need the old one without contextify, try jsdom-no-contextify.

The node-gyp EACCES can be solved by changing access and sometimes setting node-gyp python version for npm as follows:

sudo chown -R $USER /usr/local

and

npm config set python /usr/bin/python2.7

(Change python2.7 to python2.6 depending on which version is relevant)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top