20

I'm getting an error when using npm to install grunt-cli globally. It's related to lodash:

npm WARN deprecated lodash@2.4.2:
lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^3.0.0.

Here are the versions i'm using, and the list of global packages installed.

node: v5.1.0

npm: v3.5.0

npm list -g: http://pastebin.com/NuJU3bY0


I've attempted to install the latest version of lodash (v3.10.1) globally, but I still got the error again after uninstalling my grunt-cli global package, and then re-installing my global package. Below is the installation log:

sudo npm install lodash -g
/usr/local/lib
└── lodash@3.10.1

sudo npm install grunt-cli -g
npm WARN deprecated lodash@2.4.2: 
lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^3.0.0.

/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
/usr/local/lib
└─┬ grunt-cli@0.1.13
  ├─┬ findup-sync@0.1.3
  │ ├─┬ glob@3.2.11
  │ │ ├── inherits@2.0.1
  │ │ └─┬ minimatch@0.3.0
  │ │   ├── lru-cache@2.7.3
  │ │   └── sigmund@1.0.1
  │ └── lodash@2.4.2
  ├─┬ nopt@1.0.10
  │ └── abbrev@1.0.7
  └── resolve@0.3.1

npm WARN In grunt-cli@0.1.13 replacing bundled version of nopt with nopt@1.0.10
npm WARN In grunt-cli@0.1.13 replacing bundled version of findup-sync with findup-sync@0.1.3
npm WARN In grunt-cli@0.1.13 replacing bundled version of resolve with resolve@0.3.1
npm WARN In grunt-cli@0.1.13 replacing bundled version of lodash with lodash@2.4.2
npm WARN In grunt-cli@0.1.13 replacing bundled version of glob with glob@3.2.11
npm WARN In grunt-cli@0.1.13 replacing bundled version of inherits with inherits@2.0.1
npm WARN In grunt-cli@0.1.13 replacing bundled version of minimatch with minimatch@0.3.0
npm WARN In grunt-cli@0.1.13 replacing bundled version of sigmund with sigmund@1.0.1
npm WARN In grunt-cli@0.1.13 replacing bundled version of lru-cache with lru-cache@2.7.3
npm WARN In grunt-cli@0.1.13 replacing bundled version of abbrev with abbrev@1.0.7

Can anyone tell me what i'm doing wrong, or how to fix this error and get a clean install of grunt-cli?

Mastrianni
  • 3,900
  • 3
  • 20
  • 32
  • speaking of ```lodash``` see what feature you are using, if you can just use vanilla JS way. for example ```merge``` can be replaced by ```Object.assign``` and in my case I was only using ```merge```, and removed lodash, and no more npm errors. – Janatbek Orozaly May 27 '21 at 01:05

2 Answers2

19

The packagegrunt-cli relies on a older version of lodash. It shouldn't affect the functionality of grunt; it's just a warning message.

So, you're doing nothing wrong, it's not an error message, just a warning, and the way you've installed grunt-cli should work fine.

Tennyson H
  • 1,705
  • 15
  • 28
  • 1
    just curious, how to solve it? make a change in grunt cli repo? – Kat Lim Ruiz Dec 04 '15 at 19:07
  • 13
    This answer may give some peace of mind but it really doesn't solve the issue which is an unwanted warning – Neithan Max Dec 07 '15 at 10:05
  • @Sherlock the OP's question: "what am I doing wrong?": nothing. "how to fix this error?": it's not an error, it's a warning. the OP thinks they're doing something wrong that results in this error, but it's just a warning due to no fault of the OP. the only solution to "fix" the error is to go update `grunt-cli` to not rely on a old lodash install. – Tennyson H May 05 '16 at 17:23
-5

You can try running this command in your console:

npm i -g lodash

Let me know if this fixes it.

Maverick
  • 876
  • 2
  • 12
  • 22
  • Hello, I meet the same warning when I install Phonegap. I tried your command line, it showed lodash@4.3.0 but the warning is still there when I re-install Phonegap. – Pierre Feb 09 '16 at 09:50
  • 1
    @Pierre this command installs lodash globally, so you have now two different versions of lodash installed (the global one, and the Phonegap one). – William Feb 13 '16 at 17:48
  • A local version will always take precedence over a global one. I see no other way to fix this issue by fixing `crunt-cli` itself. – Backslash36 Aug 17 '16 at 11:18