2017-07-16 55 views
2

我使用節點JS,角角CLI項目,我最近克隆的項目我的工作我的Windows機器,但它並沒有提供一個給出以下erorr,其中作爲項目在我的linux機器上完美運行,可能的原因是什麼?無法供職於Windows環境下的窗口

ng serve 
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200 ** 
12% building modules 22/38 modules 16 active ...tend\node_modules\strip-ansi\index.jsError: No module factory available for dependency type: ContextElementDependency 
    at Compilation.addModuleDependencies (node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:206:21) 
    at Compilation.processModuleDependencies (node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:195:8) 
    at _this.buildModule.err (node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:336:13) 
    at building.forEach.cb (node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:140:27) 
    at Array.forEach (native) 
    at callback (node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:140:13) 
    at module.build (node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:167:11) 
    at resolveDependencies (node_modules\@angular\cli\node_modules\webpack\lib\ContextModule.js:133:4) 
    at ContextModule.result.resolveDependencies (node_modules\@ngtools\webpack\src\plugin.js:229:25) 
    at ContextModule.build (node_modules\@angular\cli\node_modules\webpack\lib\ContextModule.js:103:8) 
    at Compilation.buildModule (node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:142:10) 
    at factoryCallback (node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:325:11) 
    at node_modules\@angular\cli\node_modules\webpack\lib\ContextModuleFactory.js:96:12 
    at node_modules\tapable\lib\Tapable.js:204:11 
    at done.then (node_modules\@ngtools\webpack\src\plugin.js:231:28) 
13% building modules 27/43 modules 16 active ...lar\material\@angular\material.es5.js 
node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:265 
           if(_this.profile) { 
             ^

TypeError: Cannot read property 'profile' of null 
    at factoryCallback (node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:265:13) 
    at factory (node_modules\@angular\cli\node_modules\webpack\lib\NormalModuleFactory.js:253:5) 
    at applyPluginsAsyncWaterfall (node_modules\@angular\cli\node_modules\webpack\lib\NormalModuleFactory.js:99:14) 
    at node_modules\tapable\lib\Tapable.js:204:11 
    at NormalModuleFactory.params.normalModuleFactory.plugin (node_modules\@angular\cli\node_modules\webpack\lib\CompatibilityPlugin.js:52:5) 
    at NormalModuleFactory.applyPluginsAsyncWaterfall (node_modules\tapable\lib\Tapable.js:208:13) 
    at resolver (node_modules\@angular\cli\node_modules\webpack\lib\NormalModuleFactory.js:74:11) 
    at process.nextTick (node_modules\@angular\cli\node_modules\webpack\lib\NormalModuleFactory.js:205:8) 
    at _combinedTickCallback (internal/process/next_tick.js:73:7) 
    at process._tickCallback (internal/process/next_tick.js:104:9) 

我還試圖通過運行在Ubuntu上的bash納克服務在Windows它給了以下錯誤

npm start 

> bu[email protected] start 
> ng serve 

EINVAL: invalid argument, uv_interface_addresses 
Error: EINVAL: invalid argument, uv_interface_addresses 
    at Error (native) 
    at Object.lib.networkInterfaces (node_modules/macaddress/index.js:31:21) 
    at Object.lib.one (node_modules/macaddress/index.js:79:26) 
    at Object.<anonymous> (node_modules/uniqid/index.js:15:77) 
    at Module._compile (module.js:570:32) 
    at Object.Module._extensions..js (module.js:579:10) 
    at Module.load (module.js:487:32) 
    at tryModuleLoad (module.js:446:12) 
    at Function.Module._load (module.js:438:3) 
    at Module.require (module.js:497:17) 
    at require (internal/module.js:20:19) 
    at Object.<anonymous> (node_modules/postcss-filter-plugins/dist/index.js:9:15) 
    at Module._compile (module.js:570:32) 
    at Object.Module._extensions..js (module.js:579:10) 
    at Module.load (module.js:487:32) 
    at tryModuleLoad (module.js:446:12) 

npm ERR! Linux 3.4.0+ 
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start" 
npm ERR! node v6.11.1 
npm ERR! npm v3.10.10 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] start: `ng serve` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] start script 'ng serve'. 
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 businessops package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  ng serve 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs businessops 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls businessops 
npm ERR! There is likely additional logging output above. 

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

這裏是NPM-中的debug.log內容:

0 info it worked if it ends with ok 
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'start' ] 
2 info using [email protected] 
3 info using [email protected] 
4 verbose run-script [ 'prestart', 'start', 'poststart' ] 
5 info lifecycle [email protected]~prestart: [email protected] 
6 silly lifecycle [email protected]~prestart: no script for prestart, continuing 
7 info lifecycle [email protected]~start: [email protected] 
8 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true 
9 verbose lifecycle [email protected]~start: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games 
10 verbose lifecycle [email protected]~start: CWD: 
11 silly lifecycle [email protected]~start: Args: [ '-c', 'ng serve' ] 
12 silly lifecycle [email protected]~start: Returned: code: 1 signal: null 
13 info lifecycle [email protected]~start: Failed to exec start script 
14 verbose stack Error: [email protected] start: `ng serve` 
14 verbose stack Exit status 1 
14 verbose stack  at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:255:16) 
14 verbose stack  at emitTwo (events.js:106:13) 
14 verbose stack  at EventEmitter.emit (events.js:191:7) 
14 verbose stack  at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14) 
14 verbose stack  at emitTwo (events.js:106:13) 
14 verbose stack  at ChildProcess.emit (events.js:191:7) 
14 verbose stack  at maybeClose (internal/child_process.js:891:16) 
14 verbose stack  at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 
15 verbose pkgid [email protected] 
16 verbose cwd /mnt/c/Users/saif/Documents/Angular/Businessops/frontend 
17 error Linux 3.4.0+ 
18 error argv "/usr/bin/nodejs" "/usr/bin/npm" "start" 
19 error node v6.11.1 
20 error npm v3.10.10 
21 error code ELIFECYCLE 
22 error [email protected] start: `ng serve` 
22 error Exit status 1 
23 error Failed at the [email protected] start script 'ng serve'. 
23 error Make sure you have the latest version of node.js and npm installed. 
23 error If you do, this is most likely a problem with the businessops package, 
23 error not with npm itself. 
23 error Tell the author that this fails on your system: 
23 error  ng serve 
23 error You can get information on how to open an issue for this project with: 
23 error  npm bugs businessops 
23 error Or if that isn't available, you can get their info via: 
23 error  npm owner ls businessops 
23 error There is likely additional logging output above. 
24 verbose exit [ 1, true ] 
+0

的誤差有在該線'如果(_this.profile){'。更正或更新代碼 – Aravind

+0

後的事情是,這不是我的我的代碼,裏面node_modules存在錯誤; webpack模塊。 –

回答

0

我有同樣的問題。這是WLS中的一個已知錯誤(請參閱https://github.com/Microsoft/WSL/issues/1343)。

下面是解決方法:https://github.com/Microsoft/WSL/issues/1343#issuecomment-279781472

// hack for Ubuntu on Windows 
try { 
    require('os').networkInterfaces(); 
} 
catch (e) { 
    require('os').networkInterfaces =() => ({}); 
} 

地點的代碼在一個文件,並要求其在webpack.config.js文件。

在我的情況下,錯誤來自node_modules/macaddress/index.js,只是在開始時添加此代碼來解決問題。

看來問題已經在最新的Windows版本10。

相關問題