I'm trying to deploy app to Heroku, but it fails with [webpack-cli] Error: Cannot find module './homedir'.
When I run ./gradlew build
in my console, everything works perfectly, but the moment I'm trying to push into heroku remote it fails with this error.
This is full error stack trace:
https://pastebin.com/wRLBgBXz
CodePudding user response:
Have you tried running the build as a prestart script, e.g.
"scripts": {
"prestart": "gradlew build",
"start": "your-start-cmd",
}
More info about this here. You should consider whether your build uses absolute paths to requirements.
Another question is whether this is a "prod" deployment, as installation of devDependencies vs dependencies might be at play. More info.
If your app is dockerized, you might try deploying it to Render to check whether you get the same error (full disclosure, I work for Render).
CodePudding user response:
The thing was, I forgot to remove cached files from git, after adding node_modules
to .gitignore
Also I moved all devDependencies into dependencies because of Heroku installation