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

Cannot find module 'nopt' error while performing NPM install #97

Open
rossgp opened this issue Aug 29, 2016 · 6 comments
Open

Cannot find module 'nopt' error while performing NPM install #97

rossgp opened this issue Aug 29, 2016 · 6 comments

Comments

@rossgp
Copy link

rossgp commented Aug 29, 2016

I'm trying to install the latest version (1.0.60) and I'm getting the following error:

node-pre-gyp install --fallback-to-build

module.js:340
throw err;
^
Error: Cannot find module 'nopt'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/tmp/nodejs-services/AService/node_modules/hummus/node_modules/node-pre-gyp/lib/node-pre-gyp.js:14:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

I tried installing earlier versions and 1.0.59 and 1.0.58 give me the same error but 1.0.57 works OK for me.
The issue looks to be that node-pre-gyp is added as a bundled dependency but the published package is missing its node_modules.
version 1.0.57 does come with these bundled:

ls -l ~/.npm/hummus/1.0.57/package/node_modules/node-pre-gyp/node_modules/
total 36
drwxr-xr-x 6 node node 4096 Aug 29 11:04 mkdirp
drwxr-xr-x 7 node node 4096 Aug 29 11:04 nopt
drwxr-xr-x 4 node node 4096 Aug 29 11:04 npmlog
drwxr-xr-x 5 node node 4096 Aug 29 11:04 rc
drwxr-xr-x 4 node node 4096 Aug 29 11:04 request
drwxr-xr-x 3 node node 4096 Aug 29 11:04 rimraf
drwxr-xr-x 4 node node 4096 Aug 29 11:04 semver
drwxr-xr-x 6 node node 4096 Aug 29 11:04 tar
drwxr-xr-x 4 node node 4096 Aug 29 11:04 tar-pack

I think an npm install on the node_pre_gyp package needs to be done before doing an npm publish.

Or am I missing some install step I should be doing?

Thanks,
Ross

@galkahana
Copy link
Owner

Maybe. Lets est this. Do you mind trying npm instal node-pre-gyp and then npm instal hummus?

@rossgp
Copy link
Author

rossgp commented Aug 30, 2016

Thanks for the suggestion. I tried that but it didn't work. As node_pre_gyp is already bundled require won't try to resolve this up the hierarchy - it's the dependencies it will be looking for - mkdirp, nopt e.t.c.
So I tried npm install on all these separately and now the npm install hummus works.

Is it possible for the next publish to include the dependant modules?

@galkahana
Copy link
Owner

look, the package includes node_pre_gyp as a dependency, and it in turn should install the rest. if it doesn't work, i need maybe a new node_pre_gyp, but installing its current dependencies is a bad idea.

Gal.

@galkahana
Copy link
Owner

maybe you have global install of node_pre_gyp? if i'm trying to npm install hummus i can see in node_modules under hummus nopt and the rest. is that not ok?

Gal.

@rossgp
Copy link
Author

rossgp commented Aug 30, 2016

Sorry - not suggesting to install the dependencies explicitly but I believe when using a bundled dependency you need to run npm install on it before publishing.

I see this project had a similar issue but got around it by changing from using a bundled Dependency to setting it up as a preinstall instead.
https://github.com/mapbox/node-sqlite3/issues/655

Do you need the specify this as a bundled dependency as its already under dependencies?

@rossgp
Copy link
Author

rossgp commented Aug 30, 2016

Sorry just say you previous comment come in - I'll check that out

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

2 participants