Skip to content

[BUG] npm -g update serverless@pre-3 wipes global node_modules #4240

Closed
@mnapoli

Description

@mnapoli

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Running npm -g update serverless@pre-3 wipes the content of the global node_modules directory (/usr/local/lib/node_modules).

Here is a log file of the command: https://gist.github.com/mnapoli/0170614e3f4ab1915a82783bf871d033

Here is what I tried to pinpoint the problem:

  • no problem with a local install (npm update serverless@pre-3)
  • npm -g i pure-prompt works
  • npm -g update pure-prompt works
  • npm -g i serverless works
  • npm -g update serverless works
  • npm -g i serverless@pre-3 works
  • npm -g update serverless@pre-3 ❌ wipes everything
  • yarn global add serverless works
  • yarn global update serverless@pre-3 works

Expected Behavior

Nothing should be removed, the package should be installed.

Steps To Reproduce

Run:

npm -g update serverless@pre-3

Now all global dependencies are gone (e.g. serverless, npm, etc.). The global folder /usr/local/lib/node_modules still exists, but it's empty.

I have to reinstall NPM and reinstall all global NPM dependencies.

Environment

  • npm: 8.3.0
  • Node.js: v17.3.1
  • OS Name: macOS
  • System Model Name: Bug Sur 11.6.2
  • npm config:
; "builtin" config from /usr/local/lib/node_modules/npm/npmrc

prefix = "/usr/local"

; "user" config from /Users/matthieu/.npmrc

//npm.pkg.github.com/:_authToken = (protected)
//registry.npmjs.org/:_authToken = (protected)

; node bin location = /usr/local/Cellar/node/17.3.1/bin/node
; cwd = /Users/matthieu/dev/PHP/bref
; HOME = /Users/matthieu
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions