Installing NodeJS contextify package yields an error - node.js

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.

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

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)

Related

node-pre-gyp err while trying to npm install

While trying to install sqlite I'm getting an error running with:
npm v6.4.1
node v8.11.4
Windows 10
I tried to clean cache, reinstall nodejs/npm and some random things I found in other questions here(like setting msvs version, setting python config var etc.)
Error log:
kawthar#Romana MINGW64 ~/Desktop/Nodev/Artesã (JS)
$ npm install sqlite --save
> sqlite3#4.0.2 install C:\Users\kawthar\Desktop\Nodev\Artesã (JS)\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build
'node-pre-gyp' is not recognized as an internal or external command,
operable program or batch file.
npm WARN qi-bot#1.0.0 No description
npm WARN qi-bot#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3#4.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3#4.0.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\kawthar\AppData\Roaming\npm-cache\_logs\2018-08-30T22_28_34_617Z-debug.log
Use the following command and try again:
npm install -g node-gyp

npm bcrypt installation error when using travis

I am getting a very strange error when I try to run Travis on my application after installing the bcrypt library. Everything installs and runs fine when on my local machine but when I try to use travis I get an error installing bcrypt from package.json. Anyone know how to fix this?
npm ERR! Linux 4.8.12-040812-generic
npm ERR! argv "/home/travis/.nvm/versions/node/v6.11.0/bin/node" "/home/travis/.nvm/versions/node/v6.11.0/bin/npm" "install"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! bcrypt#1.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#1.0.2 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/travis/build/SamKirkiles/Teller/Server/npm-debug.log
The command "cd $TEST_DIR && npm install && npm test" exited with 1.
Done. Your build exited with 1.
Do you have your Travis Node.js configuration set up for compiling native modules?
Try adding this to your .travis.yml under the node_js setting (merge the env: bit together with any existing settings; you only need global: if you're building using a matrix e.g. testing on more than one Node version):
env:
global:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
I extracted this from the Travis docs page linked above.
If that doesn't work, maybe try linking to your .travis.yml here so we can see more about your build process.

Failing to install the Grunt command line interface

I am currently having trouble installing the grunt command line interface, i get a whole lot of errors on the log when I try and install it using instructions off a tutorial website. I just added node.js from a package I downloaded off their website. Any help would be appreciated?
I used the following command as detailed on the roots WordPress instructions page
npm install -g grunt-cli
and this error message was returned
npm ERR! Error: Attempt to unlock grunt-cli, which hasn't been locked
npm ERR! at unlock (/usr/local/lib/node_modules/npm/lib/utils/locker.js:44:11)
npm ERR! at cb (/usr/local/lib/node_modules/npm/lib/cache/add-local.js:30:5)
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache/add-local.js:47:20
npm ERR! at /usr/local/lib/node_modules/npm/lib/utils/locker.js:30:7
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/lockfile/lockfile.js:167:38
npm ERR! at OpenReq.Req.done (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:144:5)
npm ERR! at OpenReq.done (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:64:22)
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/npm/npm/issues
npm ERR! System Darwin 13.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /Users/jonbeech
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.14
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/jonbeech/npm-debug.log
npm ERR! not ok code 0
➜ ~
Run sudo npm install -g grunt-cli you need sudo privileges when installing something globally, or remove the -g switch.
Try to avoid needing sudo with npm, there are likely going to be other permissions errors. Here is what I did after installing npm with sudo:
Uninstall NPM: sudo npm uninstall npm -g
Install NVM so that I can install npm without needing sudo (similar to RVM), see: https://github.com/creationix/nvm#installation
Install latest npm: nvm install stable
Clear caches npm cache clear
and then everything worked

Trouble installing topojson on ubuntu

I've been trying to install topojson by following Mike Bostock's Let's Make a Map tutorial http://bost.ocks.org/mike/map/ and I believe I have managed to get the most recent version of Node.js and npm. $which ogr2ogr works as well. I'm quite new to programming and Ubuntu and would sincerely appreciate some thorough help as to why npm install topojson -g yields the following errors. When I try the same command with sudo it yields errors like: npm ERR! registry error parsing json and gyp ERR! stack Error: "pre" versions of node cannot be installed, use the --nodedir flag instead
Thanks!
npm ERR! Error: EACCES, open '/home/natecraft/.npm/7edf76d6-topojson.lock'
npm ERR! { [Error: EACCES, open '/home/natecraft/.npm/7edf76d6-topojson.lock']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/natecraft/.npm/7edf76d6-topojson.lock' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.5.0-23-generic
npm ERR! command "/home/natecraft/.nvm/v0.10.15/bin/node" "/home/natecraft/.nvm/v0.10.15/bin/npm" "install" "topojson" "-g"
npm ERR! cwd /home/natecraft/Downloads/node-latest-install
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.3.5
npm ERR! path /home/natecraft/.npm/7edf76d6-topojson.lock
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/home/natecraft/.npm/7edf76d6-topojson.lock'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/natecraft/Downloads/node-latest-install/npm-debug.log
npm ERR! not ok code 0
First, please check your version of node.js -- use the stable version, not the devel version. Second, invoke the npm command as superuser.
$ sudo npm install -g topojson
So far, when I switch my node.js into stable version, TopoJSON installation is running well. Thank you for your attention.
I came across this error when installing topojson (Debian 3.2.0-4-amd64). My steps to get things working (also discussed here).
Install node v 0.11.10
git clone https://github.com/joyent/node.git
cd node
git checkout v0.11.10
./configure && make
sudo make install
Remove debian gyp and install via npm:
sudo apt-get remove gyp
npm install -g gyp
Explicitly install contextify, although that was the version already installed.
npm install contextify#0.1.7
then, installing topojson should work
sudo npm install -g topojson

Node.JS + CentOS + node-waf

I have installed Node.JS on CentOS from source like this:
yum install gcc-c++ make git
cd /usr/local/src/
git clone git://github.com/joyent/node.git
cd node
./configure
make
make install
yet while installing modules via npm I get error:
sh: node-waf: command not found
npm ERR! threads_a_gogo#0.1.5 install: `node-waf configure install`
npm ERR! `sh "-c" "node-waf configure install"` failed with 127
npm ERR!
npm ERR! Failed at the threads_a_gogo#0.1.5 install script.
npm ERR! This is most likely a problem with the threads_a_gogo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-waf configure install
npm ERR! You can get their info via:
npm ERR! npm owner ls threads_a_gogo
npm ERR! There is likely additional logging output above.
is this issue CentOS related, or what is possibly going wrong? This link suggests that this error should only happen if Node is not installed from source....which in this case it is.
node-waf is deprecated and was removed from node 0.10: https://github.com/joyent/node/issues/3475.
You should open an issue with the package you are trying to use to get it updated to node-gyp.

Resources