Search code examples
npmprefixpackage-lock.json

Why does "npm install" prefix my packages with "node_modules" in my "package-lock.json" file?


I've never had this happen before, but now, when I npm install in the root directory of my app, my package-lock.json updates all the packages with node_modules/. What is causing this?

Here's what I get before running npm i

before running command

Here's what I get after running npm i

after running command


Solution

  • What version of npm (and node) are you using?

    npm v7 has been released, and it ships with node v15. That introduces some big changes due to the new support for workspaces... which introduces package-lock.json v2.

    I'm going to go out on a limb: I suspect you're running npm v7 locally and your EC2 instances are not.

    https://github.blog/2020-10-13-presenting-v7-0-0-of-the-npm-cli/