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

时间:2018-09-25 13:40:54

标签: cordova ionic-framework

我打算为此应用程序添加一个新插件,它在离子服务上工作正常,但是当我决定使用离子科尔多瓦构建它来构建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.

ionic cordova build 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"

其他信息: 离子性:

ionic(Ionic 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    操作系统:macOS High Sierra    Xcode:Xcode 9.4.1 Build版本9F2000

1 个答案:

答案 0 :(得分:0)

我修复了缺少脚本文件的错误,因此我必须在其中创建一个包含“ www / script.js”的新目录 问题解决了!!