1) Having empty new directory
2) Init new package.json (tried with yarn and npm)
3) add react-scripts package (can be added manually into package.json, but it does not matter)
4) Getting error: error Couldn't find a package.json (or bower.json) file in /Users/schovi/tmp/xxx/node_modules/react-scripts/node_modules/autoprefixer
15:51 $ mkdir ~/tmp/xxx && cd ~/tmp/xxx
~/tmp/xxx
15:51 $ yarn init
yarn init v0.15.1
questions ...
β¨ Done in 2.89s.
15:51 $ yarn add react-scripts
yarn add v0.15.1
info No lockfile found.
[1/4] π Resolving packages...
warning react-scripts > jest > jest-cli > istanbul-api > fileset > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
error Couldn't find a package.json (or bower.json) file in /Users/schovi/tmp/xxx/node_modules/react-scripts/node_modules/autoprefixer
at /usr/local/Cellar/yarn/0.15.1/libexec/lib/node_modules/yarn/lib/config.js:355:13
at next (native)
at step (/usr/local/Cellar/yarn/0.15.1/libexec/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at /usr/local/Cellar/yarn/0.15.1/libexec/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:20
info Visit http://yarnpkg.com/en/docs/cli/add for documentation about this command.
System:
OSx Sierra
Node 6.8.0
Yarn 0.15.1 (installed via homebrew)
PS: when installing with npm, everything is fine.
Same issue here.
Please retest with yarn 0.16.+
, I'm unable to reproduce the error now.
@busches Same error
[3/4] π Linking dependencies...
error Couldn't find a package.json (or bower.json) file in /Users/schovi/tmp/xx/node_modules/react-scripts/node_modules/autoprefixer
version is really 0.16.0
Weird! works for me. I'm using the same version 0.16.0
. Node v6.9.1
& macOS 10.12
.
Solved! yarn cache clean
helped. Not sure how broken version get there.
This might help someone else who stumbles across this page - I had this error when my directory/package.json didn't have the right file permissions
@joe4mg, what permissions does the package.json need?
I was also finding this issue.
@schovi yarn cache clean
didn't fix the problem for me.
Was running version v0.27.5
, fairly out of date.
Upgraded yarn to latest version v1.5.1
via brew with:
brew upgrade yarn
And that fixed it.
package.json resolution works in sub-folders again.
ππππππππ
yarn cache clean didn't solve my problem (couldn't find package,json file). But running it as administrator (-@windows) did.
My case was that I was not in the right folder when I run yarn
. I had another folder inside the folder where I tried to run yarn start
. The project files were in the other folder nested.cd
to the correct folder and run yarn start
- _This worked for me._
In my case, I just went to a wrong directory - the parent directory of my react project.
So just make sure in the directory where you contains your react project.
(Yes, I guessed. My comment will be downvoted.)
cd your_react_app
then
yarn start
My case was that I was not in the right folder when I run
yarn
. I had another folder inside the folder where I tried to runyarn start
. The project files were in the other folder nested.cd
to the correct folder and runyarn start
- _This worked for me._
this was the fix, it worked for me, thanks a lot man, really helped me a lot
just ran into this issue also. make sure your in the same directory as your package.json.
Muito bom !!!
eu tbm acionei yarn start no diretorio errado .
obrigado
For me, I wan in the wrong folder, cd to the right project and yarn run develop
cd your_react_app
then
yarn start
Thank you, it did work for me.
yarn add package.json
worked for me
When you create a new project with "yarn create ..." you aren't in the correct folder, so cd (name of project) then yarn start :)
Not sure why I received this email?
Sent from Yahoo Mail for iPhone
On Monday, August 3, 2020, 9:50 AM, Gustavo Mori notifications@github.com wrote:
When you create a new project with "yarn create ..." you aren't in the correct folder, so cd (name of project) then yarn start :)
β
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Meu caso foi que eu nΓ£o estava na pasta correta quando executo
yarn
. Eu tinha outra pasta dentro da pasta onde tentei executaryarn start
. Os arquivos do projeto estavam na outra pasta aninhada .cd
para a pasta correta e executeyarn start
- _Isso funcionou para mim._
Obrigada por compartilhar essa informaΓ§Γ£o, resolveu meu problema!
yarn cache clean didn't solve my problem (couldn't find package,json file). But running it as administrator (-@windows) did.
this solved my problem, simple, thks
Most helpful comment
My case was that I was not in the right folder when I run
yarn
. I had another folder inside the folder where I tried to runyarn start
. The project files were in the other folder nested.cd
to the correct folder and runyarn start
- _This worked for me._