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

Within a docker build, Modules dependant on node-gyp fail (only where npm-shrinkwap in use) #1105

Closed
vidhill opened this issue Feb 4, 2017 · 6 comments

Comments

@vidhill
Copy link

vidhill commented Feb 4, 2017

Not sure which is the best place for this,

We are using a number of npm packages which in turn have a dependancy on node-gyp,

i.e. my project does not directly use node-gyp

We run npm-install as part of our docker image build process..

When I put a npm-shrinkwrap.json in place the npm install is failing due to errors relating to python not being in place..

gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:449:14)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:353:11
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:69:16)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:81:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:90:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Linux 4.4.0-59-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

Maybe I need to include a python install as part of pre-build

But my confusion is, why is would fail for this reason only when the npm-shrinkwrap is in place?

@vidhill vidhill changed the title Within docker build, Modules dependant on node-gyp fail (where npm-shrinkwap in use) Within a docker build, Modules dependant on node-gyp fail (where npm-shrinkwap in use) Feb 5, 2017
@vidhill vidhill changed the title Within a docker build, Modules dependant on node-gyp fail (where npm-shrinkwap in use) Within a docker build, Modules dependant on node-gyp fail (only where npm-shrinkwap in use) Feb 5, 2017
@bnoordhuis
Copy link
Member

Maybe there are install scripts that start node-gyp, that's something a quick grep -r through your node_modules directory should be able to tell you.

If that isn't it, you'll probably have more luck getting your question answered at https://github.com/npm/npm/issues. node-gyp's role is a passive one, it only does what it's told by the process that started it, presumably npm.

@vidhill
Copy link
Author

vidhill commented Feb 6, 2017

node-gyp is being kicked off by a https://github.com/kesla/node-snappy

I was able to get it to work by installing python, make and GCC as part of the docker build process, but it seems strange to me that this is necessary in this case

@vidhill vidhill closed this as completed Feb 6, 2017
@vidhill
Copy link
Author

vidhill commented Feb 6, 2017

My solution was to modify my docker image to install the dependancies of node-gyp:
make, GCC and python

So that the node-gyp script could run.

As to why the behaviour is different from the shrinkwrap non skrinkwrapped is still a bit of a mystery to me

@iwarner
Copy link

iwarner commented Jun 7, 2017

@vidhill Can you please provide your dockerfile I am constanly getting Gyp errors - sepecifally around Python paths.

@mtrogers
Copy link

@vidhill I second this motion

@vidhill
Copy link
Author

vidhill commented Jul 26, 2017

Hi,
I can't share the exact Dockerfile, as it's not an open source project, for now I'll create a gist..

https://gist.github.com/vidhill/0a85dc1848feee4171944dc4d7757895

-this is an untested Dockerfile because I'm off to bed now..
if this doesn't help I can create a proper mini-project

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