Gregory Boutte
Gregory Boutte

Reputation: 733

ionic apk build "Cannot find module 'caller-path'"

I have a ionic application with angular and i want to build the apk.

I've run ionic capacitor add android

And then when i run ionic capacitor build android i get an error

An unhandled exception occurred: Cannot find module 'caller-path'

I tried to run the same commands from a docker container and i don't have the errors.

I tried to re-run npm install but nothing changes.

I would like to be able to run the apk generation from my windows computer, do you have any idea ?

Here is the full stacktrace of the error

[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)

Upvotes: 0

Views: 303

Answers (1)

Gregory Boutte
Gregory Boutte

Reputation: 733

I found the solution, i just deleted the node_modules folder and re installed the dependencies with npm install, then everythings worked.

Upvotes: 1

Related Questions