2016-04-05 69 views
1

我從這裏克隆運行NPM啓動時無法找到模塊 '的WebPack':錯誤:角2的WebPack啓動

https://github.com/AngularClass/angular2-webpack-starter

安裝,使用一些警告:

npm install typings webpack-dev-server rimraf webpack -g 

在第一它是在抱怨RxJs--想要的版本2,但是在package.json中是版本4.我更新了package.json,以便RxJs版本是2.

警告哪裏那些:

npm WARN cannot run in wd [email protected] npm run typings -- install (wd=/vagrant_data) 
npm WARN engineStrict Per-package engineStrict (found in this package's package.json) 
npm WARN engineStrict won't be used in npm 3+. Use the config setting `engine-strict` instead. 
npm WARN unmet dependency /vagrant_data/node_modules/typedoc requires [email protected]'1.6.2' but will load 
npm WARN unmet dependency /vagrant_data/node_modules/typescript, 
npm WARN unmet dependency which is version 1.8.9 
npm WARN unmet dependency /vagrant_data/node_modules/html-webpack-plugin/node_modules/pretty-error/node_modules/renderkid requires [email protected]'~0.3' but will load 
npm WARN unmet dependency /vagrant_data/node_modules/html-webpack-plugin/node_modules/pretty-error/node_modules/utila, 
npm WARN unmet dependency which is version 0.4.0 
npm WARN unmet dependency /vagrant_data/node_modules/typings/node_modules/update-notifier/node_modules/configstore/node_modules/mkdirp requires [email protected]'0.0.8' but will load 
npm WARN unmet dependency /vagrant_data/node_modules/typings/node_modules/minimist, 
npm WARN unmet dependency which is version 1.2.0 

現在運行

npm start 

> [email protected] start /vagrant_data 
> npm run server:dev 


> [email protected] server:dev /vagrant_data 
> webpack-dev-server --config config/webpack.dev.js --inline --progress --profile --colors --watch --display-error-details --display-cached --content-base src/ 

root directory: /vagrant_data 
module.js:327 
    throw err; 
    ^

Error: Cannot find module 'webpack' 
    at Function.Module._resolveFilename (module.js:325:15) 
    at Function.Module._load (module.js:276:25) 
    at Module.require (module.js:353:17) 
    at require (internal/module.js:12:17) 
    at Object.<anonymous> (/vagrant_data/config/webpack.common.js:5:15) 
    at Module._compile (module.js:409:26) 
    at Object.Module._extensions..js (module.js:416:10) 
    at Module.load (module.js:343:32) 
    at Function.Module._load (module.js:300:12) 
    at Module.require (module.js:353:17) 
    at require (internal/module.js:12:17) 

npm ERR! Linux 3.2.0-4-amd64 
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "server:dev" 
npm ERR! node v4.4.2 
npm ERR! npm v2.15.0 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] server:dev: `webpack-dev-server --config config/webpack.dev.js --inline --progress --profile --colors --watch --display-error-details --display-cached --content-base src/` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] server:dev script 'webpack-dev-server --config config/webpack.dev.js --inline --progress --profile --colors --watch --display-error-details --display-cached --content-base src/'. 
npm ERR! This is most likely a problem with the angular2-webpack-starter package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  webpack-dev-server --config config/webpack.dev.js --inline --progress --profile --colors --watch --display-error-details --display-cached --content-base src/ 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs angular2-webpack-starter 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR! 
npm ERR!  npm owner ls angular2-webpack-starter 
npm ERR! There is likely additional logging output above. 
npm ERR! Linux 3.2.0-4-amd64 
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "server:dev" 
npm ERR! node v4.4.2 
npm ERR! npm v2.15.0 
npm ERR! path npm-debug.log.1202353761 
npm ERR! code EACCES 
npm ERR! errno -13 
npm ERR! syscall open 

npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.1202353761' 
npm ERR!  at Error (native) 
npm ERR! { [Error: EACCES: permission denied, open 'npm-debug.log.1202353761'] 
npm ERR! errno: -13, 
npm ERR! code: 'EACCES', 
npm ERR! syscall: 'open', 
npm ERR! path: 'npm-debug.log.1202353761' } 
npm ERR! 
npm ERR! Please try running this command again as root/Administrator. 

npm ERR! Please include the following file with any support request: 
npm ERR!  /vagrant_data/npm-debug.log 

npm ERR! Linux 3.2.0-4-amd64 
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start" 
npm ERR! node v4.4.2 
npm ERR! npm v2.15.0 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] start: `npm run server:dev` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] start script 'npm run server:dev'. 
npm ERR! This is most likely a problem with the angular2-webpack-starter package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  npm run server:dev 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs angular2-webpack-starter 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR! 
npm ERR!  npm owner ls angular2-webpack-starter 
npm ERR! There is likely additional logging output above. 
npm ERR! Linux 3.2.0-4-amd64 
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start" 
npm ERR! node v4.4.2 
npm ERR! npm v2.15.0 
npm ERR! path npm-debug.log.514887008 
npm ERR! code EACCES 
npm ERR! errno -13 
npm ERR! syscall open 

npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.514887008' 
npm ERR!  at Error (native) 
npm ERR! { [Error: EACCES: permission denied, open 'npm-debug.log.514887008'] 
npm ERR! errno: -13, 
npm ERR! code: 'EACCES', 
npm ERR! syscall: 'open', 
npm ERR! path: 'npm-debug.log.514887008' } 
npm ERR! 
npm ERR! Please try running this command again as root/Administrator. 

npm ERR! Please include the following file with any support request: 
npm ERR!  /vagrant_data/npm-debug.log 

從上線 - NPM-文件的debug.log我甚至不看。

爲什麼我得到錯誤,如果安裝時沒有發現這樣的錯誤,webpack沒有找到?

我現在安裝在流浪者的圖像上,但我試圖安裝在我的Mac電腦上,看起來很熟悉。

回答

0

我有一個類似的問題,我沒有去當地安裝在我的項目文件夾在這裏windows。你可以嘗試在本地application文件夾中安裝它,使用npm install webpack

+0

當我運行npm install webpack時,它停止拋出錯誤。但仍然 - 爲什麼它不在package.json中運行此命令時未安裝? –

+0

這個線程可能會幫助你... https://github.com/webpack/webpack/issues/2131 – Thalaivar

1

當運行像「故宮開始」的NPM腳本,該腳本對定義可執行腳本模塊的依賴,NPM將尋找路徑,以便使該可執行文件node_modules.bin文件夾。

通過只使用安裝模塊:

npm install webpack 

沒有-g會做到這一點,將路徑添加到文件夾node_modules.bin

使用安裝模塊-g將有可能給你運行命令:

webpack 

自己。

你可以看到npm腳本如何在this link上工作。