npm@5.3: npm prune --production fails #17781
Comments
We have the same issue with npm 5.3.0 |
A few details on how it affects us: we're shipping an Electron app for Linux/macOS/Windows. We ship a PKGBUILD for ArchLinux - the Arch package for npm has already been upgraded to @5.3.0 - there's no way to depend on 5.2.0 specifically, so if the user already has 5.3.0 installed, the PKGBUILD will just fail on the (Electron apps typically run I've tried working around it by wiping I think I'm out of workaround until npm@5.4.0 ships Here's an npm debug log showing the failure: https://gist.github.com/fasterthanlime/d72dabfb7467f8909b95aa6e1f3e1f40 Another npm debug log right after running Reading the npm source, unbuild.js calls Neither of these files have been touched between 5.2.0 and 5.3.0 though. Confirming that: this happens
|
Can confirm this happens on MacOS High Sierra (10.13) too. |
I still haven't been able to find a workaround: this prevents us from releasing a new version of our app on some platforms. I hate to look impatient but npm is a pretty critical piece of infrastructure 😄 Any kind of status update would be super appreciated! ❤️ |
@fasterthanlime I was able to roll back with |
Thanks! That's not applicable when releasing an install script for Arch Linux though: https://github.com/itchio/itch/blob/master/release/templates/PKGBUILD.in - if I depend on |
I'm having this issue too, both on widows 10 x64 and on ubuntu 14.04. |
This is due to a known issue with npm@5.3.0: npm/npm#17781
@GianlucaBortoli Do you mean the problem happens with npm > 5.2 ? |
@bishbashbosh123 by bad, I just fixed the comment to stress that the broken npm versions are > 5.2 |
I would think that a viable workaround for this would just be to run: rm -rf node_modules package-lock.json && npm install --production |
I realize you're trying to help, but:
I'd like to highlight that this isn't just "some dude's weird setup", it's the way most electron apps are packaged for production - this bug breaks electron-packager for all npm@5.3.0 users, for example: electron/packager#686 |
The package-lock and shrinkwrap are interchangeable (you can literally rename them to one another). Except, the former cannot be published, which makes it quite useless in my opinion as it is not included in the distributable tarball. I think what you are happy about, perhaps without realizing it, is the new
That does look problematic. I don't know much about that tool, but I would expect there to be a mechanism to bypass the postinstall hooks. In fact, you can do this in a blunt force way with npm's |
Right! shrinkwrap is dead, long live shrinkwrap. (I didn't realize it was a "backwards-compatible upgrade" rather than a different format, I'm not sure many npm@5 users do either!)
Ah but the thing is, we very much want to run the postinstall hooks. Folks who develop electron apps have two versions of v8:
the two versions of v8 that electron ships are always synchronized, for compatibility reason (they interoperate quite a bit by default, and you can make them interoperate even more with the electron IPC api, remote requires, etc.) However, there's a good chance that the version of v8 electron ships and the version of v8 used by I suppose a working workaround based on yours would be: rm -rf node_modules
npm install --production --ignore-scripts
npm install --no-save electron-rebuild --ignore-scripts
node_modules/.bin/electron-rebuild
npm remove electron-rebuild --ignore-scripts Although, it's starting to be a lot of trouble for what looks like a simple regression 😕 That's not to say that there isn't other, more complicated workarounds - some electron apps have a nested "app" folder that contains a second |
For unrelated reasons, I just published fresh-cli, which does the reinstall trick I mentioned above. Sounds like it won't fix the |
Temp fix for npm/npm#17781
Any news on this? It's starting to impact our users of our older versions. |
Super easy reproduction steps ✨ mkdir prune-test && cd prune-test
npm init -y
npm install -D yes
npm prune --production Output:
|
I downgraded, was able to get past this error for one build, but now getting same error with |
@fasterthanlime Thanks, yes that works. I had npm installed as a local dependency as well as global, and it seems both were getting used at some point, so I had to update my project local npm dep as well as global dep (this is an app that requires npm to run npm commands programmatically). |
@fasterthanlime It works now with 5.4.0. Thanks for the info. |
wasted 1 day . |
@dsslimshaddy Thanks you save my day !! The right cmd is |
I fixed this issue by executing below command. |
@ananthfrancis this specific issue has been resolved in the latest npm release 5.4. Downgrading is no longer recommended. You may still have issues with native add-ons though in which case you should follow discussion on #18277. |
@robjtede Good luck getting npm 5.4 installed if you are using nvm-windows. Npm is non-upgradable, the perfect paradox. We are downgrading to 8.1 we have no choice. |
With npm 5.4 I got the following error:
|
* Lock version of `@types/node` to `8.0.14` * Code style change in `release` script
Remove code that removes `node_modules/.bin/*` as the issue that fixes was actually an issue with `npm` that is now fixed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - See: npm/npm#17781
The Problem now occurs on npm 5.6.0 Before updating everything worked on 5.4 but now with 5.6.0 electron-packager breaks with
|
Have the same issue running
|
More about the problem with the current version of npm: npm/npm#17781
See more details at npm/npm#17781
I'm opening this issue because:
What's going wrong?
npm prune --production
fails withnpm ERR! May not delete: /path/node_modules/.bin
NODE_ENV=production npm prune
fails withnpm ERR! May not delete: /path/node_modules/.bin
How can the CLI team reproduce the problem?
Run
NODE_ENV=production npm prune
ornpm prune --production
in any project which has anode_modules/.bin
folder with npm@5.3.0npm@5.2.0 is working as expected.
supporting information:
npm -v
prints: 5.3.0node -v
prints: v8.1.4npm config get registry
prints: https://registry.npmjs.org/The text was updated successfully, but these errors were encountered: