Skip to content
Advertisement

dependencies not showing in package.json in Node.js

I am new to node.js. I know when I install a new module in node.js using npm install it gets installed but in package.json i cant find the package name in dependencies. I know i can type it out but it should appear when i install it using command prompt it should appear. Here’s my package.json file. `

JavaScript

Please advice and let me know if I am wrong at something.

I use npm install command to install all the packages but its not showing in the dependencies.

`

Advertisement

Answer

Quickest way to fix this would be to run:

JavaScript

And that should add them to the package.json

Update:

Couple of extra commands for future viewers of the OP:

To add the package to your devDependencies instead of dependencies

npm install <dependencies listed here> --save-dev


There are also some handy shortcuts for both commands:

dependencies:

  • npm i <dependencies listed here> -S

dev-dependencies:

  • npm i <dependencies listed here> -D

The npm documentation is here.

And if you are a fan of shortcuts and npm configuration here is a useful link to find even more.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement