NPM - Cannot find name 'Many' and Cannot find namespace '_' from lodash library

旧时模样 提交于 2019-12-05 19:45:11

The latest lodash uses typescript 2.1 which is not compatible with ionic right now which uses ts 2.0 still. As you can see on my package.json file I used

"typescript": "2.0.10"

So, if you are using the same version as mine and ended up with the same error just install

$ npm install --save lodash

and add this to your package.json file inside the dependencies

"dependencies": {
    ...
    "@types/lodash": "ts2.0"
}

and

$ npm install

you can now import

import * as _ from "lodash";

I was facing the same problem and after some googling I found this comment https://github.com/driftyco/ionic-app-scripts/issues/700#issuecomment-276684485. Installing typescript 2.0 compatible types solved this problem for me. Use "@types/lodash": "ts2.0" in your package.json.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!