question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Insight as to why this might not work with Heroku deployment?

See original GitHub issue

npm run build successfully appends the file when I run it locally but not when Heroku runs it during deployment. I can see that it’s running the script in the deploy logs but when I view the file in build it doesn’t have the appended code.

=====> Detected Framework: React.js (create-react-app)
       Using existing `static.json`
       Enabling runtime environment variables
> react-app@0.1.0 build /tmp/build_...
> npm run build-css && react-scripts build && cra-append-sw ./custom-sw.js

Thanks for making this workaround!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bplittlecommented, Jan 5, 2018

Update: When I use the --skip-compile flag it works as expected!

So just to summarize, without the flag npm run build works fine locally, but not when deployed via Heroku (babel-loader error seen in the build logs above occurs and the file is not appended).

Thanks for your tool!

0reactions
temitopecommented, Dec 14, 2018

FWIW i am getting a similar issue when trying to build. Isolated the same behavior by running it directly from the bin folder in node_module install folder. Calling it directly on the custom-sw.js i created. ----Output—

(node:90864) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Hash: c68b1d1fde198868d1dc
Version: webpack 4.27.1
Time: 60ms
Built at: 2018-12-14 13:47:29
    Asset   Size  Chunks             Chunk Names
bundle.js  4 KiB    main  [emitted]  main
Entrypoint main = bundle.js
[0] multi ./src/custom-service-worker.js 28 bytes {main} [built]

ERROR in multi ./src/custom-service-worker.js
Module not found: Error: Can't resolve 'babel-loader' in '/Users/username/web-app'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Node.js Deploys - Heroku Dev Center
Your Node.js deploy failed - now what? Start with these simple steps to troubleshoot a build issue. Check the buildpack. Is the app...
Read more >
Deploying to heroku does not work · Issue #221 · rauchg/slackin
It appears to be due to this line, which expects dist/ to exist, but does not by default, since it is ignored from...
Read more >
Heroku app deployed successfully but Application Error
I'm trying to deploy a simple python Dash app to Heroku, I can deploy the app without any issues but I keep getting...
Read more >
7. When It Goes Wrong - Heroku: Up and Running [Book]
Not to worry, though—deployment is the best place your application could fail. Ideally, it means that you just avoided deploying an app with...
Read more >
Heroku deploy not working, app working on local machine
Open a terminal. Run heroku logs -t , and then using a different terminal, browser, whatever, cause the error. You will then have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found