2016-12-04 62 views
0

我的工作環境得到錯誤當我運行時遇到這些錯誤ionic serve運行時, 「離子服務」

> [email protected] ionic:serve /Users/Hao/Project/OneCharacter 
> ionic-app-scripts serve 

module.js:597 
    return process.dlopen(module, path._makeLong(filename)); 
       ^

Error: dlopen(/Users/Hao/Project/OneCharacter/node_modules/@ionic/app-scripts/node_modules/node-sass/vendor/darwin-x64-48/binding.node, 1): no suitable image found. Did find: 
    /Users/Hao/Project/OneCharacter/node_modules/@ionic/app-scripts/node_modules/node-sass/vendor/darwin-x64-48/binding.node: truncated mach-o error: segment __TEXT extends to 1212416 which is past end of file 121392 
    at Error (native) 
    at Object.Module._extensions..node (module.js:597:18) 
    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> (/Users/Hao/Project/OneCharacter/node_modules/@ionic/app-scripts/node_modules/node-sass/lib/index.js:23:15) 
    at Module._compile (module.js:570:32) 
    at Object.Module._extensions..js (module.js:579:10) 

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

npm ERR! Please include the following file with any support request: 
npm ERR!  /Users/Hao/Project/OneCharacter/npm-debug.log 
There was an error serving your Ionic application: There was an error with the spawned command: serve 

我已經在我的項目中運行了npm install。看來這是一個關於node-sass的問題?或者,也許這是由於網絡不好?

回答

0

如果您的網絡連接不好,那麼這可能是問題所在。我面臨類似的問題。 「離子服務」需要互聯網連接才能正確執行。

然而,如果不是這種情況,請嘗試運行以下命令,以滿足您的應用程序開發模式:

npm run ionic:serve 

我也建議你使用以下更新離子CLI更穩定的版本命令:

# May need "sudo" 
npm install -g [email protected] 
+0

哦......我忘了關閉這個問題。但還是非常感謝你!我認爲我的問題很可能是由於網絡不好(因爲我在中國)。以下是中國程序員可能的解決方案:https://github.com/lmk123/blog/issues/28 – awmleer

相關問題