我有一个在ionic版本1中构建的旧项目,但是在尝试ionic Serv或ionic cordova构建android --release --verbose时,我遇到了错误
离子型:-1 节点版本:-10.8.0 系统:-ubuntu 16.04ionic:cli-utils:bootstrap local CLI 3.15.1 found at /path_to_project/node_modules/ionic/package.json +0ms
ionic:cli-utils Terminal info: { tty: true, ci: false } +0ms
ionic:cli-utils CLI global options: { _: [ 'cordova', 'build', 'android' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, release: true, project: null, '--': [] } +3ms
[WARN] Detected locally installed Ionic CLI, but it's too old--using global CLI.
ionic:cli-utils:lib:project Project type from config: Ionic 1 (ionic1) +0ms
ionic:cli-utils Project name: undefined +160ms
ionic:cli Context: { binPath: '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/usr/local/lib/node_modules/ionic', execPath: '/path_to_project', version: '4.1.1' } +0ms
ionic:cli-utils:lib:integrations:cordova:config Using config.xml: /path_to_project/config.xml +0ms
ionic:cli-utils:lib:hooks Looking for ionic:build:before npm script. +0ms
ionic:cli-utils:lib:build Looking for ionic:build npm script. +0ms
> ionic-v1 build
2018-09-02T12:22:50.666Z ionic:v1-toolkit:lib:gulp Using gulpfile: /path_to_project/gulpfile.js
2018-09-02T12:22:50.669Z ionic:v1-toolkit:lib:gulp Using gulp: /path_to_project/node_modules/gulp/index.js
ionic-v1[9634]: ../src/node_contextify.cc:637:static void node::contextify::ContextifyScript::New(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `args[1]->IsString()' failed.
1: 0x8b8210 node::Abort() [ionic-v1]
2: 0x8b82e5 [ionic-v1]
3: 0x8eb237 node::contextify::ContextifyScript::New(v8::FunctionCallbackInfo<v8::Value> const&) [ionic-v1]
4: 0xb4daa8 [ionic-v1]
5: 0xb4fa12 v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [ionic-v1]
6: 0xf8bb3d041bd
[ERROR] Non-zero exit from subprocess.
答案 0 :(得分:1)
以下是解决此问题的可能方法:
1]尝试以下命令:
rm -fr node_modules
rm -fr package-lock.json
npm cache clean --force
npm install
或
2]尝试使用以下命令安装Node.js的本机JavaScript模块:
npm i natives