运行时, “离子服务”
问题描述:
我的工作环境得到错误当我运行时遇到这些错误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
的问题?或者,也许这是由于网络不好?
答
如果您的网络连接不好,那么这可能是问题所在。我面临类似的问题。 “离子服务”需要互联网连接才能正确执行。
然而,如果不是这种情况,请尝试运行以下命令,以满足您的应用程序开发模式:
npm run ionic:serve
我也建议你使用以下更新离子CLI更稳定的版本命令:
# May need "sudo"
npm install -g [email protected]
哦......我忘了关闭这个问题。但还是非常感谢你!我认为我的问题很可能是由于网络不好(因为我在中国)。以下是中国程序员可能的解决方案:https://github.com/lmk123/blog/issues/28 – awmleer