运行“离子服务”时出错

时间:2016-12-04 04:00:55

标签: ionic-framework npm ionic2

我的工作环境是:

MACOS

节点v6.9.1

npm v3.10.8

离子v2.1.14

运行ionic serve时出现了这些错误:

> ionic-app-base@ 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! ionic-app-base@ ionic:serve: `ionic-app-scripts serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-app-base@ 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的问题?或者可能是由于网络不好?

1 个答案:

答案 0 :(得分:0)

如果您的网络连接不正确,那么这可能就是问题所在。我遇到了类似的问题。 &#34;离子服务&#34;需要正确执行互联网连接。

尽管如此,如果不是这样,请尝试运行以下命令以在开发模式下为您的应用程序提供服务:

npm run ionic:serve

我还建议您使用以下命令将离子CLI更新为更稳定的版本:

# May need "sudo"
npm install -g ionic@2.2.3