npm postinstall start before all dependencies are installed #2872

Closed
shakty opened this Issue Oct 12, 2012 · 4 comments

Comments

Projects
None yet
4 participants

shakty commented Oct 12, 2012

Hi,

I have this configuration

mymodule / node_modules/ smoosh
mymodule / node_modules/ SUBMODULE / node_modules / smoosh

SUBMODULE shares the dependency 'smoosh' with his parent. That means that smoosh will be installed only in the parent node_modules directory.

Now, SUBMODULE has a postinstall script that uses smoosh. However, this script is run before all the dependecies in the parent node_modules folder are downloaded. That is:

mymodule / node_modules/ smoosh/

exists, but

mymodule / node_modules/ smoosh/ node_modules

is empty, and therefore smoosh fails.

I have npm 1.1.12, node 0.6.14

Thanks!

Member

mfncooper commented Oct 13, 2012

Please upgrade to the latest npm (v1.1.63) and see if that resolves the issue. The version you're using (v1.1.12) is pretty old.

shakty commented Nov 22, 2012

Hi,

I have upgraded to npm 1.1.65 and node v0.8.14, but the problem persists. The only difference that the error is non-blocking, that is after the npm install finished with errors, I can do npm install SUBMODULE, and that run fine.

Thank you very much!

Owner

isaacs commented Nov 26, 2012

This is a known issue and there is no way to make this work without a lot of work.

Is it really necessary to have this as a postinstall script? Why not do it as a prepublish script, and only list smoosh as a devDependency? Then you don't have to run the same computation on every install.

If you're actually installing some binary for the target architecture, then you should be using gyp, not an external JS module.

isaacs closed this Nov 26, 2012

scriby commented Feb 12, 2014

I want to reference a typescript project using a git root in the package.json. Being able to kick off the typescript compiler on module install (after dependencies were loaded) would have been an easy way to make this work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment