Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using react-scripts from parent folder results in strange behaviour #1240

Closed
ashtonsix opened this issue Dec 11, 2016 · 6 comments
Closed

Using react-scripts from parent folder results in strange behaviour #1240

ashtonsix opened this issue Dec 11, 2016 · 6 comments
Milestone

Comments

@ashtonsix
Copy link
Contributor

ashtonsix commented Dec 11, 2016

Background

I'm building a library with several examples, these examples use create-react-app but I don't want people to waste lots of time by repeatedly installing react-scripts. So I moved the react-scripts dependency to the project root.

Steps to reproduce

Run the following inside an empty folder:

npm install -g create-react-app@1.0.2
npm install --save react@15.4.0 react-dom@15.4.0
npm install --save-dev react-scripts@0.8.3
mkdir examples
cd examples
create-react-app counter
cd counter
npm uninstall --save react react-dom
npm uninstall --save-dev react-scripts
npm start

Navigate to localhost:3000 and you might see something like:

issue

Which can be fixed by moving examples/counter/public/index.html to examples/counter/index.html (though some additional errors are reported in the console like URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico').

This seems like behavior from an older version of react-scripts but I'm not sure.

Environment

node -v # 6.2.0
npm -v  # 3.10.5
# Windows 7
# Chrome 54
@gaearon
Copy link
Contributor

gaearon commented Dec 11, 2016

Why did you close this? Is it solved?

@ashtonsix
Copy link
Contributor Author

I clicked the button by mistake

@gaearon
Copy link
Contributor

gaearon commented Dec 11, 2016

How can we solve this? Would changing this to be based on __dirname work?

@gaearon gaearon added this to the 0.9.0 milestone Dec 11, 2016
@ashtonsix
Copy link
Contributor Author

ashtonsix commented Dec 29, 2016

Just tried that, changing process.cwd() to __dirname has no effect.

I've found switching from npm to yarn significantly improves installation times making the original solution unnecessary ie, this issue no longer affects me. The issue remains but I'm not personally motivated to fix it anymore. But thanks for the help (& sorry I took ages to respond)!

@ashtonsix ashtonsix reopened this Jan 2, 2017
@ashtonsix
Copy link
Contributor Author

Keep seeing "close" in OctoDroid + thinking it means "back"

@gaearon gaearon modified the milestones: 1.0.0, 0.9.0 Jan 23, 2017
@Timer
Copy link
Contributor

Timer commented Mar 14, 2017

Duplicate of #556. Going to close this. 😄

@Timer Timer closed this as completed Mar 14, 2017
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants