-1

I try to install node packeges with nmp. When i run, it says:

up to date, audited 356 packages in 7s

found 0 vulnerabilities

I see it as a dependency in my package-json like this:

"dependencies": {
    "express": "*",
    "nodemon": "*"
  }

but there is no node_modules was installed..

Hope someone can help.

edit: I tried the commands given in the answers but it didn't work. still same

ss from editor

  • Have you looked [at any of these suggestions](https://stackoverflow.com/questions/18401606/npm-doesnt-install-module-dependencies)? – Andy Apr 06 '22 at 17:47
  • Can you run `ls -la` in the root of the project and add the output to your question? – jabaa Apr 06 '22 at 17:47
  • Don't add dependencies manually. Remove that `dependecies` section from your `package.json`, save and close the file, then run `npm i -s express nodemon` in your project directory. This will install the latest versions of both, with semver syntax to make sure you don't automatically install the next major version (should one come out) because major versions break backward compatibility and you never want those to get blindly installed. And if the regular way to install packages still doesn't work, please update your post accordingly. – Mike 'Pomax' Kamermans Apr 06 '22 at 18:00
  • Please check your answers available, try them, and see if they helped. Thanks! – Arnav Thorat Apr 06 '22 at 21:57

2 Answers2

0

These commands solve the same problem and have a look at the attached links.

https://github.com/npm/npm/issues/17282

Can't install anything using "npm install"

npm install -g npm
npm cache clean
npm update
npm install
Milan Sachani
  • 335
  • 3
  • 8
0

There are a few fixes to this issue.


The first one is to install the dependencies manually, as so.

$ npm install -s express nodemon

The command should install express and nodemon at the latest versions.


The second option is to run a few commands, as so (in the order given).

$ npm install -g npm
$ npm cache clean --force
$ npm update
$ npm install

Basically, these are what the commands do (from 1-4).

  1. This installs npm from npm (sounds weird, but there is an npm package).
  2. This command forcefully cleans out the cache of npm.
  3. As you can tell, npm update updates npm!
  4. Finally, this command should be run in a directory where there is a package.json file. This installs all the dependencies listed in package.json.

Don't type out the $ in the terminal examples!

Arnav Thorat
  • 3,078
  • 3
  • 8
  • 33