2017-09-14 70 views
0

我試圖從 here角2樣品的WebPack項目加載失敗的WebPack-DEV-服務器

運行的角度機關所確定的項目下載後,我跑NPM安裝。然後我試着用npm start運行服務器。但不知何故,它給我以下錯誤:

           Asset  Size Chunks     Chunk Names 
assets/angular.72e938844d7d3f68edf83a97e34f0859.png 4.45 kB   [emitted] 
        vendor.23469b081171ef5c7a6b.js 1.01 MB  0 [emitted] [big] vendor 
         app.23469b081171ef5c7a6b.js 1.87 kB  1 [emitted]   app 
        polyfills.23469b081171ef5c7a6b.js  117 kB  2 [emitted]   polyfills 
         app.23469b081171ef5c7a6b.css 107 bytes  1 [emitted]   app 
        app.23469b081171ef5c7a6b.css.map 312 bytes  1 [emitted]   app 
             index.html 555 bytes   [emitted] 
    [23] ./~/@angular/core/@angular/core.es5.js 490 kB {0} [built] 
    [58] ./~/@angular/platform-browser/@angular/platform-browser.es5.js 141 kB {0} [built] 
    [71] ./~/@angular/common/@angular/common.es5.js 132 kB {0} [built] 
    [92] ./~/@angular/platform-browser-dynamic/@angular/platform-browser-dynamic.es5.js 5.88 kB {0} [built] 
[193] ./~/@angular/http/@angular/http.es5.js 74.6 kB {0} [built] 
[194] ./~/@angular/router/@angular/router.es5.js 220 kB {0} [built] 
[195] ./src/app/app.module.ts 1.22 kB {1} [built] 
[196] ./~/core-js/es6/index.js 5.88 kB {2} [built] 
[197] ./~/core-js/es7/reflect.js 510 bytes {2} [built] 
[198] ./~/rxjs/Rx.js 9.65 kB {0} [built] 
[199] ./~/zone.js/dist/zone.js 119 kB {2} [built] 
[318] ./~/core-js/modules/es6.string.fixed.js 189 bytes {2} [built] 
[631] ./src/main.ts 416 bytes {1} [built] 
[632] ./src/polyfills.ts 365 bytes {2} [built] 
[633] ./src/vendor.ts 416 bytes {0} [built] 
    + 622 hidden modules 
Child html-webpack-plugin for "index.html": 
     [0] ./~/html-webpack-plugin/lib/loader.js!./src/index.html 301 bytes {0} [built] 
Child extract-text-webpack-plugin: 
     [0] ./~/css-loader/lib/css-base.js 1.46 kB {0} [built] 
     [1] ./~/css-loader?sourceMap!./src/assets/css/styles.css 463 bytes {0} [built] 

> angular-io-ex[email protected] start C:\Users\anand\webpack 
> webpack-dev-server --inline --progress --port 8080 

10% building modules 3/3 modules 0 activeevents.js:160 
     throw er; // Unhandled 'error' event 
    ^

Error: listen EACCES 127.0.0.1:8080 
    at Object.exports._errnoException (util.js:1026:11) 
    at exports._exceptionWithHostPort (util.js:1049:20) 
    at Server._listen2 (net.js:1244:19) 
    at listen (net.js:1293:10) 
    at net.js:1403:9 
    at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:62:16) 
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:81:10) 

npm ERR! Windows_NT 10.0.15063 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" 
npm ERR! node v6.9.1 
npm ERR! npm v3.10.8 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] start: `webpack-dev-server --inline --progress --port 8080` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] start script 'webpack-dev-server --inline --progress --port 8080'. 
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 angular-io-example package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  webpack-dev-server --inline --progress --port 8080 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs angular-io-example 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls angular-io-example 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Users\anand\webpack\npm-debug.log 

是否與我的本地機器或別的東西什麼問題?

+0

你的JavaScript錯誤:'拋兒; //未處理'錯誤'事件 –

+0

我沒有修改代碼,我剛剛運行了項目,因爲它在教程 –

+1

中給出我認爲它與權限問題有關,可能是您的端口8080已被其他系統服務使用。嘗試更改端口 –

回答

1

在本地計算機端口8080上運行的其他東西,請在您的package.json文件端口更改

"scripts": { 
"start": "webpack-dev-server --inline --progress --port 4200", 
"test": "karma start", ...