Home > Back-end >  npm install not installing any package
npm install not installing any package

Time:11-08

I just had my first brush with Node. Now I am trying to install some npm packages.

Whenever I run the command npm install package-name, it doesn't show any error and it also does not install the package(no node_modules folder, just does nothing). Here is the kind of message I get:

up to date, audited 248 packages in 11s

8 packages are looking for funding run npm fund for details

19 vulnerabilities (6 moderate, 9 high, 4 critical)

To address issues that do not require attention, run: npm audit fix

To address all issues (including breaking changes), run: npm audit fix --force

Run npm audit for details.

I have also tried npm i package-name and npm install --save package-name, but all give the same message. I'm currently using Node version 18.12.1.

What could I be doing wrong and what could be causing this issue?

CodePudding user response:

may be you have not initialised your git repository.So, first run command git init -y on your terminal as it will create default package.json and package-lock.json files and after that you can install different packages.

CodePudding user response:

In order to install npm packages locally, you should run the npm init command first. A file called package.json will be created which contains basic information about the project and the dependencies used in it. Then in the same directory run the installation command.

CodePudding user response:

Silly me. The fix was to initialize npm in the folder. I ran npm init -y and everything works fine now.

  • Related