Angular2 - Angular-CLI installing lodash - Cannot find module

前端 未结 5 1859
庸人自扰
庸人自扰 2020-12-19 02:19

Mac OSX El capitan | angular-cli: 0.1.0 | node: 5.4.0 | os: darwin x64

I try to install a 3rd party npm module according to the angular-cli wiki: https://github.com/

5条回答
  •  臣服心动
    2020-12-19 02:46

    With the stable release and current angular-cli (1.0.0-beta.15), it's simply adding the npm package plus type definitions

    npm install lodash --save
    npm install @types/lodash --save-dev
    

    For early versions such as 1.0.0-beta.15, the next is necessary. It should not be required for current versions:

    Add the library to the angular-cli.json to list of global scripts (add "../node_modules/lodash/lodash.js" to the list apps[0].scripts).

    See https://github.com/angular/angular-cli#global-library-installation

提交回复
热议问题