-
Notifications
You must be signed in to change notification settings - Fork 3k
npm 2 can't install optional dependencies in shrinkwrap generated with npm 3 #8707
Comments
@djanowski: Isn't this the case with a shrinkwrap from the same project in npm@2? |
That is, does it actually matter what version you created the shrinkwrap with? My impression was that npm@2 would shrinkwrap optional deps if they installed ok, and so would create this same scenario. |
I hit this same bug and wanted to expand upon it. The same thing will happen when you run the entire process in Linux for that same package. It appears that optional dependencies (even ones that don't get installed) are hoisted into the shrinkwrap file.
Build succeeds. There is no indication that the optional dependency did not install. There's even a
Shinkwrap file now has
Now that it's installed, switch back to
|
I'm 90% sure that this is actually caused by this bug: Where npm@3 is not checking the os & arch |
I'm seeing a similar EBADPLATFORM with fsevents on linux, when using npm v2.13.4 with shrinkwrap generated by npm v3.2.2.
The shrinkwrap block generated by npm3 for fsevents is:
But npm 2.x doesn't seem to like that. |
@mblakele This appears to be an area where the shrinkwrap file doesn't translate well across platforms. I'm pretty sure that this bug exists in |
I agree: it seems like an npm2 bug, at least if npm2 is meant to handle shrinkwrap generated by npm3. That's what I'd like it to handle, so that I can use 3 in dev and 2 in CI and prod. |
I think it's entirely possible to reproduce this failure using only |
Perhaps there should be some way to exclude optional deps from a shrinkwrap– npm would still install them when they're available, but they would stop exploding things when they aren't. |
So I put together a minimal test case for this and the shrinkwrap files produced by npm@2 and npm@3 are byte-for-byte identical. Obviously this wouldn't be the case for real projects where flattening will produce different trees, but it does show that the behavior around optional deps and shrinkwraps is the same in both versions. Folks who are seeing this, can you give me a real world example of a package.json for your failure case? |
@iarna I found a little time to create a single-package test case using
Failure:
debug log: https://gist.github.com/mblakele/a5877913ca944c8c4601 |
Any suggestions for a work-around when someone (a newbie) is having this problem? Can I do some clean-up and resolve the issue? npm ERR! notsup Unsupported Thanks! |
Upgrading to npm 3.3.5 fixed this for me. (likely fixed in #8921 like iarna suggested) |
My test case https://gist.github.com/mblakele/0d0cd3147b82892bb0a3 still fails when installing on linux with npm@2.14.6 using shrinkwrap generated by osx with npm@3.3.6. |
See also #2679 |
Steps to reproduce:
npm shrinkwrap
The text was updated successfully, but these errors were encountered: