npm install removes all installed packages using --save-dev


(Levi) #1

What I Wanted to Do

Tried to install packages with this command:
npm install --save-dev babel-loader babel-plugin-transform-object-rest-spread

What Happened Instead

627 packages were removed:

npm WARN babel-loader@8.0.2 requires a peer of @babel/core@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ babel-loader@8.0.2
+ babel-plugin-transform-object-rest-spread@6.26.0
added 3 packages from 3 contributors, removed 627 packages, updated 1 package and audited 6694 packages in 10.1s
found 0 vulnerabilities

Running npm install again resolves the issue, but I thought this issue was fixed a long time ago.

Reproduction Steps

You may reproduce the issue by running:

  • npm i create-react-app@1.5.2 -g
  • create-react-app package-bug-test
  • npm install --save-dev babel-loader babel-plugin-transform-object-rest-spread


Platform Info

$ npm --versions
$ node -p process.platform

$ node --version

(Kat Marchán) #2

This is because CRA is using Yarn under the hood. Yarn does not install packages in an npm-compatible way. We’ve talked to them about adding some necessary metadata, but that hasn’t landed. I recommend running an npm install after you use CRA to make sure you’re back in npm mode.

(system) closed #3

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.