How to make my NPM package package "npm WARN prefers global" when installing locally

Difficult for google subj - there are too many user questions, mine is about package development. I want the user of my package to see that "npm WARN prefers global" when installing it non-globally.

I thought I had npm install yosuch a warning, but now it is not. At least I do not see this.

My environment:

npm --version
1.4.10node -v
v0.10.28
+4
source share
2 answers

Ben Fortune , npm , ( - "preferGlobal": true package.json).

, , , , .

npm 2.3.0, , , npm install <pkgName> (.. -g):

- npm WARN prefer global <pkgName>@<ver> should be installed with -g - , :

  • package.json ,
  • dependencies / optionalDependencies, ( ) - .

, npm install <pkgName> (.. -g) :

  • , npm ( package.json).
  • npm, ( dependencies / optionalDependencies) - devDependencies / peerDependencies ).
  • npm, pkgName, ( ) ( dependencies optionalDependencies).

, --loglevel silly , .

: npm (http://npmjs.com) , npm install <pkgName> -g; -g.
[: - 14 2015 . - . https://github.com/npm/newww/issues/1017]

+10

"preferGlobal": true

package.json.

+9

Source: https://habr.com/ru/post/1544758/


All Articles