Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Building app does not work with yarn #23

Closed
vaclavbohac opened this issue Dec 19, 2016 · 7 comments
Closed

Building app does not work with yarn #23

vaclavbohac opened this issue Dec 19, 2016 · 7 comments

Comments

@vaclavbohac
Copy link

Deploying a react app with yarn.lock fails to compile the app as yarn ignores the NPM_CONFIG_PRODUCTION flag and omits the dev dependencies necessary to run the webpack.

There's a simple workaround as all you need to do is to delete yarn.lock file from the project and the build scripts will fall back to the npm (https://github.com/heroku/heroku-buildpack-nodejs/blob/v93/bin/compile#L54). But that't not what you really want to do

@gaearon
Copy link

gaearon commented Dec 19, 2016

Should the be filed with Yarn?

@mars
Copy link
Owner

mars commented Dec 19, 2016

The underlying Node buildpack recently added Yarn support, so I imagine this should not be too difficult to get working 🤞

How does one for devDeps to install with Yarn? Looks like NODE_ENV needs to be set to development during build in the inner buildpack.

I'm traveling for the holidays and will not have a chance to investigate immediately.

@mars
Copy link
Owner

mars commented Dec 20, 2016

It's possible that setting that config/env var manually will prove the fix:

heroku config:set NODE_ENV=development

# then redeploy
git push heroku master

If that works, then I will update the underlying buildpack compile to automate this step during npm build

@laduke
Copy link

laduke commented Dec 20, 2016

Didn't deploy something for a couple days and this happened to me too. Thanks for the thread.

heroku config:set NODE_ENV=development

worked for me. Not sure what the proper yarn solution would be.

@Aadmaa
Copy link

Aadmaa commented Dec 26, 2016

"heroku config:set NODE_ENV=development" worked for me too. For clarity ... if folks are starting a brand new web app right now and you are looking at this -- https://blog.heroku.com/deploying-react-with-zero-configuration -- for deployment instructions, add the step as shown below, or deployment to Heroku fails.

npm install -g create-react-app
create-react-app my-app
cd my-app
git init
heroku create -b https://github.com/mars/create-react-app-buildpack.git
git add .
git commit -m "react-create-app on Heroku"

// ADD to your process here:
heroku config:set NODE_ENV=development

git push heroku master
heroku open

@mars
Copy link
Owner

mars commented Jan 5, 2017

Just released support for yarn in this buildpack, so no special configuration is required to use yarn.

@mars mars closed this as completed Jan 5, 2017
@gaearon
Copy link

gaearon commented Jan 5, 2017

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants