当我使用npm全局安装grunt-cli时,出现了一个错误。与lodash有关:
npm WARN deprecated lodash@2.4.2:
lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^3.0.0.
以下是我使用的版本和安装的全局包列表。
- Node: v5.1.0 - NPM: v3.5.0 - NPM全局包列表: http://pastebin.com/NuJU3bY0
我尝试全局安装最新版本的lodash(v3.10.1),但在卸载我的grunt-cli全局包后重新安装全局包后仍然出现错误。以下是安装日志:
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
有人可以告诉我我做错了什么,或者如何修复这个错误并获得一个干净的grunt-cli安装吗?
lodash
,看看你正在使用哪些功能,如果可以只使用原生JS的方式。例如,merge
可以被Object.assign
替换。 在我的情况下,我只使用了merge
,并删除了 lodash,不再出现npm错误。 - Janatbek Orozaly