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

you cannot run "npm install" inside of preinstall. this creates an install loop in npm 3+ #650

Closed
tjwebb opened this issue May 28, 2016 · 7 comments
Milestone

Comments

@tjwebb
Copy link

tjwebb commented May 28, 2016

because of this: df7d542

You cannot run npm install anything inside of the preinstall, because npm install runs preinstall.
This is pointless, anyway, because node-pre-gyp is a dependency already.

This happens:

$ npm install mapnik
(node:34121) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
fetchMetadata → network   ▌ ╢███████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟

> mapnik@3.5.13 preinstall /Users/tjwebb/workspace/langa/underbuilt/api-server/node_modules/.staging/mapnik-d6304832
> npm install node-pre-gyp

(node:34209) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

> mapnik@3.5.13 preinstall /Users/tjwebb/workspace/langa/underbuilt/api-server/node_modules/.staging/mapnik-d6304832/node_modules/.staging/mapnik-5b75902b
> npm install node-pre-gyp

(node:34265) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

> mapnik@3.5.13 preinstall /Users/tjwebb/workspace/langa/underbuilt/api-server/node_modules/.staging/mapnik-d6304832/node_modules/.staging/mapnik-5b75902b/node_modules/.staging/mapnik-3e3892ff
> npm install node-pre-gyp

and so on, forever, until eventually it looks like this:

/Users/tjwebb/workspace/langa/underbuilt/api-server/node_modules/.staging/mapnik-d6304832/node_modules/.staging/mapnik-5b75902b/node_modules/.staging/mapnik-3e3892ff/node_modules/.staging/mapnik-6a353413/node_modules/.staging/mapnik-872c850e/node_modules/.staging/mapnik-8edd7495/node_modules/.staging/mapnik-ada28736/node_modules/.staging/mapnik-aa3f2198/node_modules/.staging/mapnik-129f704a/node_modules/.staging/mapnik-9e1cde87/node_modules/.staging/mapnik-89279f14/node_modules/.staging/mapnik-7b7084a4/npm-debug.log

etc.

@tjwebb
Copy link
Author

tjwebb commented Jun 2, 2016

see also #630 and #640, where others have experienced this problem as well.

@tjwebb tjwebb changed the title you cannot run "npm install" inside of preinstall. this creates an install loop in npm 3.8.9 you cannot run "npm install" inside of preinstall. this creates an install loop in npm 3+ Jun 2, 2016
tjwebb added a commit to langateam/node-mapnik that referenced this issue Jun 11, 2016
@springmeyer
Copy link
Member

In my opinion this is an npm bug and not something I'm planning to change in node-mapnik or node-pre-gyp. Pre-installing node-pre-gyp is desirable for avoiding having to bundle it. Avoiding bundling is desirable to avoid the extra weight of the dependency in the package, the possibility it will get out of sync, and the problem of bundled deps being out of date.

@tjwebb
Copy link
Author

tjwebb commented Sep 4, 2016

In my opinion this is an npm bug

npm is behaving correctly, as documented and as designed.

Avoiding bundling is desirable to avoid the extra weight of the dependency in the package

This is not a real reason. npm exists so that modules can have dependencies, which are installed during npm install.

This issue has already been filed several times by other users. It's frustrating that your response to this issue is to bury your head in the sand and act like it doesn't exist and that npm is somehow at fault.

@springmeyer
Copy link
Member

springmeyer commented Sep 9, 2016

@tjwebb I've been unable to replicate this problem myself. Are you able to replicate with npm v3.10.8?

@springmeyer
Copy link
Member

The v3.6.0 release has started bundling node-pre-gyp again. If anyone hits this issue again with >= 3.6.0 please create a new issue.

@alanb1501
Copy link

alanb1501 commented Jun 13, 2018

If you do add a npm install inside a preinstall script, use npm install --ignore-scripts to prevent the recursive calls to scripts.

@springmeyer
Copy link
Member

@balasuar - thanks: where is the documentation on this recommendation located?

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

3 participants