D
D
DaniilKhanin2016-04-21 12:23:14
npm
DaniilKhanin, 2016-04-21 12:23:14

What to put in package.json when installing npm packages globally?

Installed npm package grunt-contrib-cssmin --save-dev -g , installed it in
C:\Users\Daniel\AppData\Roaming\npm\node_modules\grunt-contrib-cssmin
But nothing changed in package.json in devDepencies , as there was no dependency, it did not exist)) and, accordingly, the grunt call did not give anything, only the question "Is the package installed?" .
So you need to write in the console to call grunt

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Kitmanov, 2016-04-21
@DaniilKhanin

So you installed it globally ( -g), it did not register in package.json. It should be like this:
And for grunt to work, you need to install two packages:

npm install grunt-cli -g # обратите внимание, этот пакет ставится глобально и добавляет в систему команду grunt
npm install grunt --save-dev # этот ставится локально и собственно выполняет работу

(To be honest, it is possible to install grunt-cli locally as well, but don't bother with that yet.)

D
DaniilKhanin, 2016-04-21
@DaniilKhanin

Konstantin, if I write in the console, I
will install the package locally, but I don’t need it, because the idea is to install the package once and use it in different projects . Or can't it be done?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question