【发布时间】:2018-10-30 17:42:45
【问题描述】:
我正在尝试构建我的 ionic 应用程序,但它失败并出现以下错误。 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。
- 所有环境变量都是正确的。
更新:
它试图从甚至不存在的d:\PsResources\DroidWorkspace\Pay\Pay\src\bin\script.js 访问script.js 文件。
【问题讨论】:
-
查看错误,它看起来与支付模块有关,无论是什么库。我会调查那个模块库的使用情况。如果它有模块支持,请确保您正在安装它并在模块中正确定义它。
-
如果模块中有任何错误,它不会使用 serve 命令运行,但在我的情况下,它使用 serve 命令运行没有错误
-
Pay@0.0.1 是什么库?
-
不是库,是我的应用名称
标签: cordova ionic-framework ionic3 android-build ionic-cli