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/
mymodule / node_modules/ smoosh/ node_modules
is empty, and therefore smoosh fails.
I have npm 1.1.12, node 0.6.14
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.
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!
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.
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.