我正在尝试构建我的离子应用程序,但它失败并出现以下错误。错误也与ionic run android
命令相同。该应用程序运行没有错误的ionic serve
命令。我什至尝试过ionic cordova build ios
,错误仍然相同。
错误:
npm run ionic:build:before
Pay@0.0.1 ionic:build:before d:\PsResources\DroidWorkspace\Pay\Pay
node ./src/bin/script.js
module.js:550
throw err;
^
Error: Cannot find module
'd:\PsResources\DroidWorkspace\Pay\Pay\src\bin\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! Pay@0.0.1 ionic:build:before: `node ./src/bin/script.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Pay@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! C:\Users\Suroor\AppData\Roaming\npm-cache\_logs\2018-10-30T17_30_14_997Z-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:
ionic (Ionic CLI) : 4.2.1 (C:\Users\Suroor\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.1, browser 4.1.0, ios 4.3.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 5 other plugins)
System:
(D:\Software\~ProgrammingTools\SDK)
NodeJS : v8.12.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 7
尝试过的解决方案:
- 删除 node_modules 并重新安装。
- 删除并安装了最新版本的 cordova 和 ionic-app-scripts。
- 将科尔多瓦降级到 4.2.0。
- 所有环境变量都是正确的。
更新:
它试图访问甚至不存在的script.js
文件。d:\PsResources\DroidWorkspace\Pay\Pay\src\bin\script.js