5

I accidently run a command in my Mern project that ' npm un dev' instead of 'npm run dev' and it delete some packages and i don't know how to recover these packages.

Talha Khan
  • 53
  • 4

3 Answers3

6

See npm uninstall:

aliases: remove, rm, r, un, unlink
                        __

npm install should put everything back, assuming package.json wasn't modified.

isherwood
  • 58,414
  • 16
  • 114
  • 157
0

The list of packages that you deleted is still contained in the package.json file. This file is located in node_modules folder. To fix your issue, just execute the command:

npm install

or the shorter equivalent:

npm i

And those packages will be restored.

More details -> https://docs.npmjs.com/cli/v8/commands/npm-install

Dennis Kozevnikoff
  • 2,078
  • 3
  • 19
  • 29
0

run npm i interminal, this will install all packages which are listed in package.json

Jhow
  • 1
  • 2
  • 2
    This is not what the op asked. He asked what the `npm un dev` command is. `npm un` is an alias for `npm uninstall`, so this answer isn't correct – Boguz Aug 24 '22 at 07:34