离子 apk 构建 "Cannot find module 'caller-path'"
ionic apk build "Cannot find module 'caller-path'"
我有一个带 angular 的离子应用程序,我想构建 apk。
我运行ionic capacitor add android
然后当我 运行 ionic capacitor build android
我得到一个错误
An unhandled exception occurred: Cannot find module 'caller-path'
我尝试 运行 来自 docker 容器的相同命令,但我没有错误。
我尝试重新运行 npm install
但没有任何变化。
我希望能够从我的 windows 电脑上 运行 生成 apk,你有什么想法吗?
这是错误的完整堆栈跟踪
[error] Error: Cannot find module 'caller-path'
Require stack:
- A:\ReposGit\project\frontend\node_modules\import-fresh\index.js
- A:\ReposGit\project\frontend\node_modules\cosmiconfig\dist\loaders.js
- A:\ReposGit\project\frontend\node_modules\cosmiconfig\dist\createExplorer.js
- A:\ReposGit\project\frontend\node_modules\cosmiconfig\dist\index.js
- A:\ReposGit\project\frontend\node_modules\cssnano\dist\index.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\build-angular\src\webpack\plugins\optimize-css-webpack-plugin.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\build-angular\src\webpack\plugins\index.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\build-angular\src\webpack\configs\browser.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\build-angular\src\webpack\configs\index.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\build-angular\src\utils\package-chunk-sort.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\build-angular\src\browser\index.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\architect\node\index.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\models\architect-command.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\commands\run-impl.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\schematics\tools\export-ref.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\schematics\tools\index.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\utilities\json-schema.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\models\command-runner.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\lib\cli\index.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\lib\init.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\bin\ng
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (A:\ReposGit\project\frontend\node_modules\import-fresh\index.js:4:20)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (A:\ReposGit\project\frontend\node_modules\cosmiconfig\dist\loaders.js:6:21)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
我找到了解决方案,我只是删除了 node_modules
文件夹并使用 npm install
重新安装了依赖项,然后一切正常。
我有一个带 angular 的离子应用程序,我想构建 apk。
我运行ionic capacitor add android
然后当我 运行 ionic capacitor build android
我得到一个错误
An unhandled exception occurred: Cannot find module 'caller-path'
我尝试 运行 来自 docker 容器的相同命令,但我没有错误。
我尝试重新运行 npm install
但没有任何变化。
我希望能够从我的 windows 电脑上 运行 生成 apk,你有什么想法吗?
这是错误的完整堆栈跟踪
[error] Error: Cannot find module 'caller-path'
Require stack:
- A:\ReposGit\project\frontend\node_modules\import-fresh\index.js
- A:\ReposGit\project\frontend\node_modules\cosmiconfig\dist\loaders.js
- A:\ReposGit\project\frontend\node_modules\cosmiconfig\dist\createExplorer.js
- A:\ReposGit\project\frontend\node_modules\cosmiconfig\dist\index.js
- A:\ReposGit\project\frontend\node_modules\cssnano\dist\index.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\build-angular\src\webpack\plugins\optimize-css-webpack-plugin.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\build-angular\src\webpack\plugins\index.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\build-angular\src\webpack\configs\browser.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\build-angular\src\webpack\configs\index.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\build-angular\src\utils\package-chunk-sort.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\build-angular\src\browser\index.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\architect\node\index.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\models\architect-command.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\commands\run-impl.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\schematics\tools\export-ref.js
- A:\ReposGit\project\frontend\node_modules\@angular-devkit\schematics\tools\index.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\utilities\json-schema.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\models\command-runner.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\lib\cli\index.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\lib\init.js
- A:\ReposGit\project\frontend\node_modules\@angular\cli\bin\ng
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (A:\ReposGit\project\frontend\node_modules\import-fresh\index.js:4:20)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (A:\ReposGit\project\frontend\node_modules\cosmiconfig\dist\loaders.js:6:21)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
我找到了解决方案,我只是删除了 node_modules
文件夹并使用 npm install
重新安装了依赖项,然后一切正常。