builder icon indicating copy to clipboard operation
builder copied to clipboard

Bug: NPM v2 runs postinstall before finishing deps install

Open boygirl opened this issue 10 years ago • 6 comments

When running npm install from a project that has a dependency on a package using [email protected], the install will fail on builder postinstall for that package I've only seen this when using node ~v4 and npm ~v2, The problem does not seem to occur for node ~0.10 and npm ~v2 or node ~v4 and npm ~v3

boygirl avatar Nov 26 '15 06:11 boygirl

@boygirl -- OK, here's a repro

$ node --version && npm --version
v4.2.2
2.14.7
$ $ npm install FormidableLabs/victory-axis#master

> [email protected] postinstall /Users/rye/Desktop/TEMP_VICTORY_AXIS/node_modules/victory-axis/node_modules/victory-label
> builder run npm:postinstall

sh: builder: command not found

... OTHER OUTPUT SNIPPED ...

ryan-roemer avatar Nov 27 '15 06:11 ryan-roemer

Diving in more, there is a closed but still multiply-reported npm issue of "npm runs postinstall script before dependencies are loaded"

The latest post 20 days ago from an npm employee is:

This has been addressed in npm@3. Postinstall scripts are now guaranteed to run after postinstall (and previous stages) have run for all of its dependencies. (Except, obviously, in the case of cycles.) If you run into issues after updating, please let is know.

ryan-roemer avatar Nov 27 '15 06:11 ryan-roemer

I'm getting what seems to be the same error with npm v3.10.10 (which comes with the current latest node, v7.2.1):

> [email protected] postinstall /Users/joshua/projects/godigital/web/node_modules/victory
> cd lib || builder run npm:postinstall || (echo 'POSTINSTALL FAILED: If using npm v2, please upgrade to npm v3. See bug https://github.com/FormidableLabs/builder/issues/35' && exit 1)

This doesn't stop me from being able to use victory within my project so far, and I get no errors when creating/rendering charts. Let me know if I can provide any other details that would help.

vuldin avatar Dec 16 '16 16:12 vuldin

FWIW, I'm getting this error with npm 4.2.0 and node 7.10.0

bmueller-sykes avatar May 22 '17 18:05 bmueller-sykes

@bmueller-sykes -- Can you paste your victory dependencies straight from package.json?

Side note -- we're going to complete solve this issue for victory modules at least by obviating it with a removal of scripts.postinstall all together on npm publishing soon.

ryan-roemer avatar May 22 '17 18:05 ryan-roemer

I think you just mean this:

"victory": "0.19.1"

For what it's worth, the app is built on top of create-react-app, with react-script version 1.0.5

bmueller-sykes avatar May 22 '17 19:05 bmueller-sykes