Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

Cannot find module nan when compiling native modules in 6.3.0 #49

Closed
toddself opened this issue Jul 9, 2016 · 5 comments
Closed

Cannot find module nan when compiling native modules in 6.3.0 #49

toddself opened this issue Jul 9, 2016 · 5 comments

Comments

@toddself
Copy link

toddself commented Jul 9, 2016

Upgrading to node 6.3.0 and I'm oddly not able to build native modules anymore. I am able to compile them fine locally (I'm using nvm) so I'm not sure if it's docker or node or npm or whatever, but this seems like the most appropriate place to start!

I've got an example for you at https://github.com/toddself/alpine-node-test

This works like a charm: docker build -f Dockerfile-4 . (FROM mhart/alpine-node:4)
This fails: docker build -f Dockerfile-6 . (FROM mhart/alpine-node:6)

Error is as follows:

> libpq@1.8.3 install /node_modules/libpq
> node-gyp rebuild

module.js:442
    throw err;
    ^

Error: Cannot find module 'nan'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at [eval]:1:1
    at ContextifyScript.Script.runInThisContext (vm.js:25:33)
    at Object.exports.runInThisContext (vm.js:77:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:541:32)
    at bootstrap_node.js:315:29
gyp: Call to 'node -e "require('nan')"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Linux 4.4.0-28-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /node_modules/libpq
gyp ERR! node -v v6.3.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 

[bunch of crap excised]

npm ERR! Linux 4.4.0-28-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v6.3.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE

npm ERR! libpq@1.8.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the libpq@1.8.3 install script 'node-gyp rebuild'.
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 libpq 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 information on how to open an issue for this project with:
npm ERR!     npm bugs libpq
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls libpq
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /npm-debug.log
@mhart
Copy link
Owner

mhart commented Jul 9, 2016

Are you running into this Node.js bug? nodejs/node#6679

@mhart
Copy link
Owner

mhart commented Jul 9, 2016

I think you probably are – try throwing this in your Dockerfile:

WORKDIR /src

@toddself
Copy link
Author

toddself commented Jul 9, 2016

Crikey! That does it.

Thanks mate!

@toddself toddself closed this as completed Jul 9, 2016
@yotamofek
Copy link

I'm still running into this problem, and I have the WORKDIR command set.

@mhart
Copy link
Owner

mhart commented Jul 20, 2016

@yotamofek can you show us your Dockerfile?

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

No branches or pull requests

3 participants