我正在尝试使用unserscore.js。我如何导入?
npm install underscore --save
import '../../node_modules/underscore/underscore.js';
import * as _ from 'underscore';
在控制台中我收到以下错误
ERROR in [default] /Users/Documents/frontend/greenlabel-material/src/app/service/pager.service.ts:1:19
Cannot find module 'underscore'.
当我安装时,我已经进行了通用运行,只是进行了重新加载。我仍然遇到上述错误,但使用下划线的代码有效。
当我杀死应用程序并重新开始时,我仍然可以获得上述内容,但无法启动。
~/Documents/frontend/dudelabel-material$ npm start
> universal-starter@2.0.0 prestart /Users/dude/Documents/frontend/dudelabel-material
> npm run build
> universal-starter@2.0.0 prebuild /Users/dude/Documents/frontend/dudelabel-material
> rimraf dist
> universal-starter@2.0.0 build /Users/dude/Documents/frontend/dudelabel-material
> webpack
Hash: dcf119e1b8926b7b46a312a731c0c7486ac21b4c
Version: webpack 2.1.0-beta.25
Child
Hash: dcf119e1b8926b7b46a3
Version: webpack 2.1.0-beta.25
Time: 9393ms
Asset Size Chunks Chunk Names
index.js 4.23 MB 0 [emitted] main
[397] ./src async 160 bytes {0} [built]
+ 680 hidden modules
ERROR in [default] /Users/dude/Documents/frontend/dudelabel-material/src/app/service/pager.service.ts:1:19
Cannot find module 'underscore'.
Child
Hash: 12a731c0c7486ac21b4c
Version: webpack 2.1.0-beta.25
Time: 4845ms
Asset Size Chunks Chunk Names
index.js 145 kB 0 [emitted] main
+ 47 hidden modules
ERROR in [default] /Users/dude/Documents/frontend/dudelabel-material/src/app/service/pager.service.ts:1:19
Cannot find module 'underscore'.
npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/Cellar/node/6.5.0/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v6.5.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! universal-starter@2.0.0 build: `webpack`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the universal-starter@2.0.0 build script 'webpack'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the universal-starter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs universal-starter
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls universal-starter
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/dude/Documents/frontend/dudelabel-material/npm-debug.log
npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/Cellar/node/6.5.0/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.5.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! universal-starter@2.0.0 prestart: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the universal-starter@2.0.0 prestart script 'npm run build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the universal-starter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs universal-starter
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls universal-starter
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/dude/Documents/frontend/dudelabel-material/npm-debug.log
那么,如何制作webpack,强调工作togeather?