Create-react-app create Blank package.json - create-react-app

I created a react app using yarn and create-react-app.
But package.json in my app is empty.
When I run yarn start, it give me an error
Usage Error : Invalid package.json in package.json
Can I do something?

Related

react-native android won't run on device

i just started a project and im trying to start the but it already has this error showing:
error: node_modules\react-native\Libraries\Image\ImageAnalyticsTagContext.js: Property body[6] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression"
this is a known issue caused by a bug in a newly released version of babel. it will impact all new react-native and expo apps. you can resolve it with yarn resolutions in a new project:
--- a/package.json
+++ b/package.json
## -25,5 +25,8 ##
},
"jest": {
"preset": "react-native"
+ },
+ "resolutions": {
+ "#babel/plugin-transform-react-display-name": "7.14.5"
}
}
After insert resulutions key on the package.json, run yarn install
Credits: https://github.com/brentvatne
Issue Link: https://github.com/facebook/react-native/issues/31961
Run this command:
npm install --save-dev #babel/plugin-transform-react-display-name
The problem is due to a babel update that affected the RN project. copy #babel from some other project and paste in node_modules or Download the #babel folder from here and replace the existing folder in the node_modules.#Babel Download
And run
npm start --reset-cache

Error when I try to run an app in android Ionic 4

I have this error when I try to run my app in android
An unhandled exception occurred: [BABEL] C:\Users\UserName\Desktop\Ionic\MyProject\www\32-es2015.js: Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "C:\Users\UserName\Desktop\Ionic\MyProject\node_modules\#babel\preset-env\lib\index.js")
See "C:\Users\UserN~1\AppData\Local\Temp\ng-GJZvQx\angular-errors.log" for further details.
[ERROR] An error occurred while running subprocess ng.
as mentioned in this workaround
delete node_modules and package-lock.json
add "resolutions": { "#babel/preset-env": "^7.8.7" } to package.json
npm install npm-force-resolutions --save-dev
npm install
npx npm-force-resolutions
npm install again
run or build your app
if the error persist in future builds of your app try from step 5 before build it.
open package.json
"dependencies": {
"#babel/compat-data": "7.8.0"
}
run command
npm install
and then build your project and it should work.

React Native: error: bundling failed: index.js: "" is not a valid identifer name

I have a React Native app which was running perfectly earlier this morning. I've deleted package-lock.json after mistakenly doing an npm install instead of a yarn install. Then I've ran yarn install and now when I try to run my app I get this error at the packager:
error: bundling failed: index.js: "" is not a valid identifer name
BUNDLE [ios, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.
I've also closed packager and Vscode, removed node_modules and tried running yarn install again but I get the same error. I haven't changed a single line in my code and it was working before that.
What is going on?
It is already opened as an issue.
https://github.com/facebook/react-native/issues/27118
https://github.com/facebook/react-native/issues/27120#issuecomment-549832676
Simply you need to delete "node_modules" and again run the command:
npm i or yarn
Also, you can simply re-create the scratch project with
react-native init example
It will work as expected. They reverted the changes on #babel/run-time at 7.7.1 version.
Have fun 🎊🎉
Delete node_modules and packages-lock.json, erase trash, close Metro Bundle, delete the app from emulator/simulator and run npm install, this way worked for me.
I had the same issue and none of the solutions mentioned here or in the links worked for me. The issue was the react-native local and global versions were different.
node node_modules/react-native/local-cli/cli.js run-ios worked for me.
and while bundling, node node_modules/react-native/local-cli/cli.js bundle --entry-file...
In short replace react-native with node node_modules/react-native/local-cli/cli.js when trying to run or bundle

ENOENT: nosuch file or directory, scandir C:\Users\user\App\node_modules whenever trying to run yarn start

When trying to run a react-native project with expo I get the following error:
ENOENT: nosuch file or directory, scandir 'C:\Users\user\app\node_modules'
I've tried:
removing node_modules from the app directory.
npm install in app directory
uninstalling expo and reinstalling
uninstalling npm globally and reinstalling
uninstalling yarn and reinstalling
clearing cache of yarn and npm
I expect the react-native project to work like it does on my other computer. I built the expo react-native app using init expo and now ANY project I try to start comes up with this weird error.
Any ideas on what to else try?
Any help would be greatly appreciated!
Create a new project and run it in the default order.
expo init yourproject => cd yourproject => expo start

yarn create not working like npx

I have a script that does this
npx create-react-app --scripts-version /tmp/tmp.V987BAD2Te/react-scripts.tgz /tmp/tmp.V987BAD2Te/test-app
Its breaking in Windows with message "Path must be a string. Received undefined".
I do not want to upgrade npm for now and so replaced this with
yarn create react-app --scripts-version /tmp/tmp.V987BAD2Te/react-scripts.tgz /tmp/tmp.V987BAD2Te/test-app
But it does not install react-scripts from the temp path.Why