Muhammad Waqas Ilyas
Muhammad Waqas Ilyas

Reputation: 11

can i install a package locally and globally at same time in node.js?

I am working on a project. I have worked with nodemon that is installed globally for development.

I edited my package.json file to add a script to automatically run a nodemon script - as shown below:

"scripts": {
  "start": "node ./bin/www",
  "dev": "nodemon  -e js,pug"
}

Now when another developer runs:

npm start dev

they will surely get a error if they have not installed the nodemon module.

I know that the solution is to install nodemon locally as a development dependency.

Is it possible to work around this problem without installing it locally?

Can I install nodemon both locally and globally at the same time?

Upvotes: 0

Views: 252

Answers (1)

bhuvnesh pattnaik
bhuvnesh pattnaik

Reputation: 1463

simply install it globally and you can use it in any of your project

command :

npm i -g nodemon

now you don't need to install it locally at all to make it work on your project.

Upvotes: 1

Related Questions