我正在构建一个旧版本的离子应用程序,最终出现此错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了我正在构建一个旧版本的离子应用程序,最终出现此错误相关的知识,希望对你有一定的参考价值。

我打算在这个应用程序中添加一个新的插件,它在离子服务上工作正常,但当我决定使用离子cordova构建它时,android结束了这个错误

   > npm run ionic:build:before

> project@0.0.1 ionic:build:before /Users/roben/Desktop/ionic/project
> node ./bin/www/script.js

module.js:550
    throw err;
    ^

Error: Cannot find module '/Users/roben/Desktop/ionic/project/bin/www/script.js'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project@0.0.1 ionic:build:before: `node ./bin/www/script.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@0.0.1 ionic:build:before script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/roben/.npm/_logs/2018-09-25T13_12_14_615Z-debug.log
[ERROR] An error occurred while running subprocess npm.

        npm run ionic:build:before exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

离子cordova的输出构建android --verbose

> npm run ionic:build:before
> project@0.0.1 ionic:build:before /Users/roben/Desktop/ionic/project> node ./bin/www/script.jsmodule.js:550    throw err;
    ^Error: Cannot find module '/Users/roben/Desktop/ionic/projectbin/www/script.js'    at Function.Module._resolveFilename (module.js:548:15)    at Function.Module._load (module.js:475:25)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project@0.0.1 ionic:build:before: `node ./bin/www/script.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@0.0.1 ionic:build:before script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/roben/.npm/_logs/2018-09-25T15_55_42_452Z-debug.log
[ERROR] An error occurred while running subprocess npm.

        npm run ionic:build:before exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
CurlyBrketssMBP:project roben$ rm -rf node_modules
^C
CurlyBrketssMBP:project roben$
CurlyBrketssMBP:project roben$ rm -rf node_modules
CurlyBrketssMBP:project roben$ npm install

> fsevents@1.2.4 install /Users/roben/Desktop/ionic/project/node_modules/fsevents
> node install

[fsevents] Success: "/Users/roben/Desktop/ionic/project/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> node-sass@4.9.0 install /Users/roben/Desktop/ionic/project/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.0/darwin-x64-57_binding.node
Download complete  ⸩ ⠋ :
Binary saved to /Users/roben/Desktop/ionic/project/node_modules/node-sass/vendor/darwin-x64-57/binding.node
Caching binary to /Users/roben/.npm/node-sass/4.9.0/darwin-x64-57_binding.node

> uglifyjs-webpack-plugin@0.4.6 postinstall /Users/roben/Desktop/ionic/project/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js


> node-sass@4.9.0 postinstall /Users/roben/Desktop/ionic/project/node_modules/node-sass
> node scripts/build.js

Binary found at /Users/roben/Desktop/ionic/project/node_modules/node-sass/vendor/darwin-x64-57/binding.node
Testing binary
Binary is fine
added 901 packages from 742 contributors and audited 4018 packages in 34.635s
found 0 vulnerabilities

CurlyBrketssMBP:project roben$ ionic corodva build android
[ERROR] Unable to find command: corodva build android

   _             _
  (_) ___  _ __ (_) ___
  | |/ _ \| '_ \| |/ __|
  | | (_) | | | | | (__
  |_|\___/|_| |_|_|\___|  CLI PRO 4.1.2


  Usage:

    $ ionic <command> [<args>] [--help] [--verbose] [--quiet] [--no-interactive] [--no-color] [--confirm] [options]

  Global Commands:

    config <subcommand> ...... Manage CLI and project config values (subcommands: get,
                               set, unset)
    docs ..................... Open the Ionic documentation website
    info ..................... Print project, system, and environment information
    login .................... Login to Ionic Pro
    logout ................... Logout of Ionic Pro
    signup ................... Create an account for Ionic Pro
    ssh <subcommand> ......... Commands for configuring SSH keys (subcommands: add,
                               delete, generate, list, setup, use)
    start .................... Create a new project

  Project Commands:

    build .................... Build web assets and prepare your app for any platform
                               targets
    capacitor <subcommand> ... (beta) Capacitor functionality (subcommands: add, copy,
                               open, run, sync, update) (alias: cap)
    cordova <subcommand> ..... Cordova functionality (subcommands: build, compile,
                               emulate, platform, plugin, prepare, requirements,
                               resources, run)
    doctor <subcommand> ...... Commands for checking the health of your Ionic project
                               (subcommands: check, list, treat)
    generate ................. Automatically create framework features (alias: g)
    git <subcommand> ......... Commands relating to git (subcommands: remote)
    integrations <subcommand>  Manage various integrations in your app (subcommands:
                               disable, enable, list)
    link ..................... Connect local apps to Ionic Pro
    monitoring <subcommand> .. Commands relating to Ionic Pro error monitoring
                               (subcommands: syncmaps)
    serve .................... Start a local dev server for app dev/testing (alias: s)
    ssl <subcommand> ......... (experimental) Commands for managing SSL keys &
                               certificates (subcommands: generate)

CurlyBrketssMBP:project roben$ ionic cordova build android
> npm run ionic:build:before

> project@0.0.1 ionic:build:before /Users/roben/Desktop/ionic/project
> node ./bin/www/script.js

module.js:550
    throw err;
    ^

Error: Cannot find module '/Users/roben/Desktop/ionic/project/bin/www/script.js'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project@0.0.1 ionic:build:before: `node ./bin/www/script.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@0.0.1 ionic:build:before script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/roben/.npm/_logs/2018-09-25T16_22_18_392Z-debug.log
[ERROR] An error occurred while running subprocess npm.

        npm run ionic:build:before exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
CurlyBrketssMBP:project roben$ ionic cordova build android --verbose
  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, project: null, '--': [] } +4ms
  ionic:cli-utils:lib:project Project type from config: Ionic Angular 3 (ionic-angular) +0ms
  ionic:cli-utils Project name: undefined +279ms
  ionic:cli Context: { binPath: '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/usr/local/lib/node_modules/ionic', execPath: '/Users/roben/Desktop/ionic/project', version: '4.1.2' } +0ms
  ionic:cli-utils:lib:integrations:cordova:config Using config.xml: /Users/roben/Desktop/ionic/project/config.xml +0ms
  ionic:cli-utils:lib:hooks Looking for ionic:build:before npm script. +0ms
  ionic:cli-utils:lib:hooks Invoking ionic:build:before npm script. +0ms
> npm run ionic:build:before

> project@0.0.1 ionic:build:before /Users/roben/Desktop/ionic/project
> node ./bin/www/script.js

module.js:550
    throw err;
    ^

Error: Cannot find module '/Users/roben/Desktop/ionic/project/bin/www/script.js'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project@0.0.1 ionic:build:before: `node ./bin/www/script.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@0.0.1 ionic:build:before script.
CurlyBrketssMBP:project roben$ ionic cordova build android --verbose  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, project: null, '--': [] } +2ms
  ionic:cli-utils:lib:project Project type from config: Ionic Angular 3 (ionic-angular) +0
ms
  ionic:cli-utils Project name: undefined +132ms
  ionic:cli Context: { binPath: '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/
usr/local/lib/node_modules/ionic', execPath: '/Users/roben/Desktop/ionic/project', version: '4.1.2' } +0ms
  ionic:cli-utils:lib:integrations:cordova:config Using config.xml: /Users/roben/Desktop/i
onic/project/config.xml +0ms
  ionic:cli-utils:lib:hooks Looking for ionic:build:before npm script. +0ms
  ionic:cli-utils:lib:hooks Invoking ionic:build:before npm script. +0ms
> npm run ionic:build:before

> project@0.0.1 ionic:build:before /Users/roben/Desktop/ionic/project
> node ./bin/www/script.js

module.js:550
    throw err;
    ^

Error: Cannot find module '/Users/roben/Desktop/ionic/project/bin/www/script.js'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project@0.0.1 ionic:build:before: `node ./bin/www/script.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@0.0.1 ionic:build:before script.
CurlyBrketssMBP:project roben$ ionic cordova build android --verbosCurlyBrketssMBP:project roben$ ionic cordova build android --verbose
  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, project: null, '--': [] } +3ms
  ionic:cli-utils:lib:project Project type from config: Ionic Angular 3 (ionic-angular) +0
ms
  ionic:cli-utils Project name: undefined +132ms
  ionic:cli Context: { binPath: '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/
usr/local/lib/node_modules/ionic', execPath: '/Users/roben/Desktop/ionic/project', version: '4.1.2' } +0ms
  ionic:cli-utils:lib:integrations:cordova:config Using config.xml: /Users/roben/Desktop/i
onic/project/config.xml +0ms
  ionic:cli-utils:lib:hooks Looking for ionic:build:before npm script. +0ms
  ionic:cli-utils:lib:hooks Invoking ionic:build:before npm script. +0ms
> npm run ionic:build:before

> project@0.0.1 ionic:build:before /Users/roben/Desktop/ionic/project
> node ./bin/www/script.js

module.js:550
    throw err;
    ^

Error: Cannot find module '/Users/roben/Desktop/ionic/project/bin/www/script.js'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project@0.0.1 ionic:build:before: `node ./bin/www/script.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@0.0.1 ionic:build:before script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/roben/.npm/_logs/2018-09-26T06_32_36_084Z-debug.log
[ERROR] An error occurred while running subprocess npm.

        npm run ionic:build:before exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
  ionic:cli-framework:utils:process onBeforeExit handler: process.exit received +0ms
  ionic:cli-framework:utils:process onBeforeExit handler: running 1 queued functions +0ms
  ionic:cli-framework:utils:process onBeforeExit handler: exiting (exit code 1) +23ms

当前节点版本

node -v
v8.12.0

科尔多瓦版

cordova -version
8.0.0

npm版本

npm -v
6.4.1

其他:

 "@ionic/app-scripts": "3.2.0",
    "@ionic/lab": "1.0.9",
    "typescript": "~2.6.2"

其他信息:离子:

离子(离子CLI):4.1.2(/ usr / local / lib / node_modules / ionic)离子框架:离子角度3.9.2 @ ionic / app-scripts:3.2.0

科尔多瓦:

cordova(Cordova CLI):8.0.0 Cordova平台:android 7.0.0,ios 4.5.5 Cordova插件:cordova-plugin-ionic-keyboard 2.1.2,cordova-plugin-ionic-webview 2.1.4,(和其他5个插件)

系统:

NodeJS:v8.12.0(/ usr / local / bin / node)npm:6.4.1 OS:macOS High Sierra Xcode:Xcode 9.4.1 Build version 9F2000

答案

我修复了错误,有一个脚本文件丢失,所以我必须创建一个新的目录bin包含“www / script.js”,问题解决了!!

以上是关于我正在构建一个旧版本的离子应用程序,最终出现此错误的主要内容,如果未能解决你的问题,请参考以下文章

成功构建后由于谷歌播放服务导致离子抛出错误

当我提交我的应用程序时,IOS 在 iTunes Connect 上返回崩溃错误。离子 3

Ionic 3 错误:无法转译程序

Cordova-plugin-facebook4 - 无法构建离子应用程序

添加平台并使用离子科尔多瓦构建时出错?

离子 apk 签名错误