Search code examples
node.jsnpmnpm-installnpm-package

What happens when you try to uninstall a package that doesn't exist in your project?


Rather than typing npm run lint I accidentally wrote npm un lint. I understand that un is a synonym for uninstall, but no package lint ever existed in our package.json.

The command line says it's added 5 packages and removed 13. The package.json hasn't changed though, and as far as I can tell neither has package-lock.json.

Running 'npm list | grep lint' only shows eslint, and lint-staged, both of which I believe are still installed.

Running npm i doesn't install anything new.

How do I find out what happened, and what packages were added/removed?


Solution

  • there are 2 scopes, namely global and local. usually, the execution of npm turns to the local and then turn to the global.

    in your case, the npm un did not follow any local scope options, such as --save, so you probably operated on the global scope.

    that is why you do not see any changes to the package-lock.json