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

Tell the author that this fails on your system: node-pre-gyp install --fallback-to-build #256

Closed
MichaelJCole opened this issue Feb 9, 2014 · 28 comments · Fixed by mapbox/node-pre-gyp#45

Comments

@MichaelJCole
Copy link

Hi, I'm getting this error in Linux Mint 16 (an Ubuntu 13.10 derivative).

sqlite3@2.2.0 install /home/michael/scm/furtheryet.org/ghost/node_modules/sqlite3
node-pre-gyp install --fallback-to-build

/usr/bin/env: node: No such file or directory
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! sqlite3@2.2.0 install: node-pre-gyp install --fallback-to-build
npm ERR! sh "-c" "node-pre-gyp install --fallback-to-build" failed with 127
npm ERR!
npm ERR! Failed at the sqlite3@2.2.0 install script.
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! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/michael/scm/furtheryet.org/ghost
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/michael/scm/furtheryet.org/ghost/npm-debug.log
npm ERR! not ok code 0

The problem is that sqlite is looking for a binary "node". In Ubuntu/Mint, this program is a HAM radio program. The repo maintainers renamed node to nodejs.

This is a possible workaround for non-HAM radio people:

sudo ln -s /usr/bin/nodejs /usr/bin/node

@springmeyer
Copy link
Contributor

Can you try checking out node-sqlite3 from github master and then edit these lines: https://github.com/mapbox/node-sqlite3/blob/master/binding.gyp#L5-L6. Change the node you see there to nodejs. And then try installing from your local checkout like npm install. Does that work?

@MichaelJCole
Copy link
Author

Hey, this is what I did:

  1. delete symlink for "node"
  2. cd my project
  3. git clone repo
  4. rm -rf node_modules
  5. change file in repo
  6. npm install ./node-sqlite3

I got this result:

npm ERR! sqlite3@2.2.0 install: node-pre-gyp install --fallback-to-build
npm ERR! sh "-c" "node-pre-gyp install --fallback-to-build" failed with 127
npm ERR!
npm ERR! Failed at the sqlite3@2.2.0 install script.
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! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "./node-sqlite3"
npm ERR! cwd /home/michael/scm/michaelcole.com
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/michael/scm/michaelcole.com/npm-debug.log
npm ERR! not ok code 0

My system has two commands: "nodejs" and "node-gyp"

If I recreate the symlink, delete node_modules, and try "npm install ./node-sqlite3
" again it works.

@springmeyer
Copy link
Contributor

closing, this is only solvable by fixing your node to truly be node not nodejs. More details at #231 (comment)

@MichaelJCole
Copy link
Author

SpringMeyer, that means it's broken on all Ubuntu installs. That doesn't seem like a quality solution.

@springmeyer
Copy link
Contributor

@MichaelJCole - can you test this:

npm install https://github.com/mapbox/node-sqlite3/tarball/ubuntu-nodejs-bin

This may fix out of the box on systems with only nodejs.

@springmeyer springmeyer reopened this Mar 10, 2014
@springmeyer
Copy link
Contributor

nevermind, that works but is not going to be viable since the approach I took to try to fix debian with nodejs completely breaks windows (mapbox/node-pre-gyp#45 (comment)).

this is really frustrating. It looks like attempts to fix this in npm did not go anywhere: npm/npm#4116.

/cc @kapouer - help: do you have any ideas here?

@kapouer
Copy link

kapouer commented Mar 11, 2014

Install "nodejs-legacy" package ?

@springmeyer
Copy link
Contributor

Is that the recommended approach? nodejs-legacy by name sounds like something that should not be used. My concern is that there are a lot of people very new to node.js trying to install sqlite3 because it is a dependency of the very popular Ghost blogging platform (https://ghost.org/) and I'm not sure they will know how to do this. Although maybe this is not a big concern: a quick search for ghost + debian shows none of the top tutorials recommending node.js from packages (instead mostly from source or from the nodejs.org binaries): https://www.google.com/search?q=ghost+%2B+ubuntu&oq=ghost+%2B+ubuntu&aqs=chrome..69i57j0l5.10335j0j7&sourceid=chrome&espv=210&es_sm=91&ie=UTF-8#q=ghost+%2B+debian

@kapouer
Copy link

kapouer commented Mar 11, 2014

Well, distributions have their drawbacks... but have other advantages as well.
https://buildd.debian.org/status/package.php?p=node-sqlite3
https://buildd.debian.org/status/package.php?p=mapnik

nodejs-legacy package will stay and be maintained along with nodejs package, so it is the recommended way to work around software installed manually (or through npm or any other way that isn't an official debian package) that depend upon "node" binary name.

Note that debian packages must depend on nodejs binary name, to avoid using node which originally belonged to another binary installable in debian (unrelated packages cannot conflict).

Right now the idea is to separate npm-installed modules from modules installed as debian packages. If i install node-sqlite3 debian package, it won't be found by npm as an already-installed dependency (if versions match) and this is an expected behavior.
Manually depending on the debian package is possible and sometimes useful on production servers (when versions happen to match):
ln -s /usr/lib/nodejs/sqlite3 node_modules/
ln -s /usr/lib/nodejs/mapnik node_modules/

@springmeyer
Copy link
Contributor

nodejs-legacy package will stay and be maintained along with nodejs package, so it is the recommended way to work around software installed manually

Okay, thanks, so closing this again with no action taken in node-pre-gyp or node-sqlite3. Anyone, therefore, that does apt-get install nodejs but not also apt-get install nodejs-legacy will have a broken system and be unable to install node-sqlite3 using npm.

@nomadster
Copy link

Same issue here: http://pastebin.com/aEGbG1x2
I'm on

MacOSX 10.10.2
nodejs-v0.11.16
$ which node
/usr/local/bin/node

I had recently switched from v0.11.14 to v0.11.16 using n.
I've also removed everything nodejs-related and installed node-v0.12.0
but still fails:

node --version
v0.12.0
npm --version
2.5.1

Any idea?

@jellyfangs
Copy link

Same problem as nomadster

@collinalexbell
Copy link

Same problem. Not with sqlite but with opencv. node-pre-gyp is the issue

node-pre-gyp ERR! stack     at ChildProcess. (/Users/collinbell/Programs/auto-catalog/node_modules/opencv/node_modules/node-pre-gyp/lib/util/compile.js:76:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:766:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:833:5)
node-pre-gyp ERR! System Darwin 14.1.0
node-pre-gyp ERR! command "node" "/Users/collinbell/Programs/auto-catalog/node_modules/opencv/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/collinbell/Programs/auto-catalog/node_modules/opencv
node-pre-gyp ERR! node -v v0.10.36
node-pre-gyp ERR! node-pre-gyp -v v0.5.31
node-pre-gyp ERR! not ok 

@springmeyer
Copy link
Contributor

@SlightlyCyborg that error contains nothing helpful. please create a new issue with a full error report otherwise I cannot help you.

@collinalexbell
Copy link

I fixed it. On mac brew does not install cmake for some packages. node-pre-gyp needs cmake. All I had to do was install cmake

@angristan
Copy link

Same probleme, nodejs 5.0.0 on Debian 8

@kapouer
Copy link

kapouer commented Oct 30, 2015

Put build-from-source=true in your npmrc and rebuild from source instead of using binary (typically what you want on debian).

@angristan
Copy link

Where is npmrc ?

@kapouer
Copy link

kapouer commented Oct 30, 2015

In debian it is read-only in /usr/share/npm/npmrc, root read-write in /etc/npmrc, or user read-write in ~/.npmrc

@angristan
Copy link

I got none of these.

@kapouer
Copy link

kapouer commented Oct 31, 2015

@angristan create ~/.npmrc !

@angristan
Copy link

Put build-from-source=true in your npmrc and rebuild from source instead of using binary (typically what you want on debian).

What do I have to rebuild ?

@kapouer
Copy link

kapouer commented Nov 4, 2015

@angristan aren't we talking about sqlite3 ?

@angristan
Copy link

@kapouer Yep, but I have to rebuild it with/from what ?

@kapouer
Copy link

kapouer commented Nov 4, 2015

Let's say you're on debian and want to install node-sqlite3 npm module, but you don't want node-pre-gyp downloading binaries.

  1. you put build-from-source=true in your ~/.npmrc
  2. npm install sqlite3

Of course, you will need gcc toolchain and sqlite3 dev dependencies installed.
apt-get install build-essential for a start.

@angristan
Copy link

That's what I have done before : no problem during the installation.
But I still have a problem when doing npm install --production for Ghost.

@marcellodesales
Copy link

Started getting this error on RHEL7 while installing node-inspector

@shemul
Copy link

shemul commented Jan 10, 2016

same problem ..still unsolved

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

Successfully merging a pull request may close this issue.

9 participants