Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-pre-gyp issue #52

Open
flemmens opened this issue Apr 17, 2016 · 10 comments
Open

node-pre-gyp issue #52

flemmens opened this issue Apr 17, 2016 · 10 comments

Comments

@flemmens
Copy link

Hi,

I have issues when trying to install tessera or any tilelive module with something called "node-pre-gyp". It seems this is something new, I already installed tessera on multiple servers in the past without problems. Now, when I try to install, for instance the module mbtiles, I received the following error:

npm WARN engine [email protected]: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.7","npm":"2.11.3"})

[email protected] install /root/.nvm/v0.12.7/lib/node_modules/mbtiles/node_modules/sqlite3
node-pre-gyp install --fallback-to-build

sh: node-pre-gyp: command not found
npm ERR! Linux 3.14.32-xxxx-grs-ipv6-64
npm ERR! argv "/root/.nvm/v0.12.7/bin/node" "/root/.nvm/v0.12.7/bin/npm" "install" "-g" "mbtiles"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the sqlite3 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 their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.

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

I have the same issue when trying to install any node linked to mapbox. I tried with different node versions, I got the same message.

I also manually installed node-pre-gyp (npm install -g node-pre-gyp), it works and I can run the program (node-pre-gyp -v > v0.6.26) but I still got the same error (sh: node-pre-gyp: command not found) when I try to install tessera or other mapbox modules.

Any idea ? Thanks

@mojodna
Copy link
Owner

mojodna commented Apr 18, 2016

@springmeyer this is one of the npm / node-pre-gyp issues I've seen around recently.

@springmeyer
Copy link

hrm. I am unable to replicate with node v0.10.40, npm v1.4.28 when running:

cd tessera
npm install
npm install mbtiles

The above works fine. Confirming: you are able to replicate with those commands but with different node and npm versions? If so, which ones and which exact command replicates this?

@flemmens
Copy link
Author

I just tried with v0.10.40, I got the same issue. However, if I install without the -g parameter, it works but in this case I have to use the full path to launch tessera (node /home/node_modules/tessera/bin/tessera.js) and when it starts I have the issue with the protocol (Error: Invalid tilesource protocol: mbtiles), which is logical since I am unable to install the protocol with npm -g (same error with node-pre-gyp).

@mojodna
Copy link
Owner

mojodna commented Apr 18, 2016

[email protected] has been fine, in my experience. 2 and 3 exhibit different errors under different conditions (-g is one of them, I think).

@flp-gpc what was the command you used to trigger that?

@flemmens
Copy link
Author

My npm version is 2.11.3, I used nvm to try several versions of node. Everything is working fine and I can install any node modules other than those from /or linked to mapbox.

My command was simply:
npm install -g tessera
or
npm install -g mbtiles

I also tried with a github clone, then just "npm install -g" from the directory, I got the same node-pre-gyp issue. The strange thing, as explained, is that I am able to install this node-pre-gyp by itself (npm install -g node-pre-gyp), and it works fine, but I still have the "command not found" issue when trying to install other modules.

@flemmens
Copy link
Author

Any idea about this issue ?

I tried to install the new version on another server on which a previous version of tessera was running perfectly, and now I got the same issue and everything is broken, I am not able to launch the service anymore :(

npm WARN deprecated [email protected]: renamed to d3-queue
npm WARN engine [email protected]: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
|

[email protected] preinstall /usr/local/lib/node_modules/tessera/node_modules/abaculus/node_modules/mapnik
npm install node-pre-gyp

npm ERR! Linux 3.14.32-xxxx-grs-ipv6-64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "node-pre-gyp"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! path /root/.npm/node-pre-gyp/0.6.26/package
npm ERR! code EACCES
npm ERR! errno -13

npm ERR! Error: EACCES, mkdir '/root/.npm/node-pre-gyp/0.6.26/package'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, mkdir '/root/.npm/node-pre-gyp/0.6.26/package']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/root/.npm/node-pre-gyp/0.6.26/package' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

@mojodna
Copy link
Owner

mojodna commented Apr 21, 2016

EACCES is the other error I was running into ;-)

For that, try clearing your npm cache as a temporary solution: npm cache clear (as root if necessary)

@flemmens
Copy link
Author

I did but unfortunately it does not change anything, I got the same error

@springmeyer
Copy link

I'm getting notified by this ticket but about all I have to add is "don't run as root" as npm is known to not work well this way. If some bug replicates when running as a normal user then to participate in this thread I would need the exact commands to replicate. Otherwise I'm not going to risk wasting time trying to replicate with partial info. Scanning the above all I see is partial info and not anything I can surely replicate with.

@mcm-jyl
Copy link

mcm-jyl commented Jan 2, 2017

The issue is that, no matter the privileges or the option set by npm (sudo npm -g), node-pre-gyp tries to pre-install as normal user without -g option.

My workaround for a similar case was as ugly as this:

sudo chmod a+w /usr/lib/node_modules/node-pre-gyp/bin/node-pre-gyp
sudo chmod a+w /usr/bin/node-pre-gyp
sudo chown vagrant:vagrant /usr/bin/node-pre-gyp
sudo npm install node-pre-gyp
sudo chmod a+rw /usr/lib/node_modules
sudo chmod a+rw /usr/bin/node-pre-gyp /usr/bin
sudo rm -r /usr/lib/node_modules/node-pre-gyp/node_modules/*

Then my stuff was working on node 4.x and 6.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants