I am new to backend and I am having issues creating react app.
I have started fresh multiple times and create a brand new terminal which I cd in a folder named "client".
As I type npx create-react-app./ I get this error:
ritamiranda#Ritas-MacBook-Air new project % cd client
ritamiranda#Ritas-MacBook-Air client % npx create-react-app./
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/xxx/Desktop/new project/client/create-react-app./package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/ritamiranda/Desktop/new project/client/create-react-app./package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xxx/.npm/_logs/2022-07-04T18_25_05_983Z-debug-0.log
ritamiranda#Ritas-MacBook-Air client % cd [client]
zsh: no matches found: [client]
ritamiranda#Ritas-MacBook-Air client % npm create react app
npm ERR! could not determine executable to run
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/ritamiranda/.npm/_logs/2022-07-04T18_26_41_818Z-debug-0.log
ritamiranda#Ritas-MacBook-Air client %
please help, thank you!
Creating a React Project
I believe you're actually missing naming your app.
To create a project, navigate to the folder where you want to store the project and from the terminal run:
npx create-react-app my-app
Instead of my-app make sure to choose whatever name you want to call your project.
You can create a project with Vite. It is faster than the comparatively traditional way. You can run the below code in your terminal.
npm create vite#latest myapp
Related
I run my React app using npm using the following command npm run start-rewired.
However, in doing so, I'm getting the below error:
> project#0.1.0 start-rewired
> react-app-rewired start
npm ERR! code ENOENT
npm ERR! syscall spawn C:\Program Files\git\bin\bash.exe
npm ERR! path C:\project
npm ERR! errno -4058
npm ERR! enoent spawn C:\Program Files\git\bin\bash.exe ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\{my-user}\AppData\Local\npm-cache\_logs\2022-03-16T15_34_33_074Z-debug-0.log
I have followed a lot of the suggestions online, including deleting the node_modules as well as clearing the npm cache using npm cache clean
I'm running npm run start-rewired in the root path of my project. I should mention that I use yarn to install the dependencies and packages, and that running yarn install worked fine.
I'm really stuck and I'm unsure on what to do at this point.
EDIT I should also mention that this project starts up fine on a different machine with the same node and npm versions.
This issue was due to the fact that npm couldn't find the bash.exe location for git. It was looking here C:\Program Files\git\bin\bash.exe but git was installed in a different location. So what I did was uninstall and reinstall git in the above location and it resolved the issue.
I just created a react app, it was working fine but once I restart the editor it is throwing error like this :
Poojas-MacBook-Air:newreact pooja$ npm start
npm ERR! path /Users/pooja/Desktop/projects/newreact/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open
'/Users/pooja/Desktop/projects/newreact/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/pooja/.npm/_logs/2020-11-28T10_27_42_118Z-debug.log
Please help if anyone knows about it.
Make sure you have the latest npm (npm install -g npm).
Add an exception to your antivirus to ignore the node_modules folder in your project.
rm -rf node_modules package-lock.json
npm install
Sometimes the PATH is not correct, just open the cmd and cd to the address where the package.json is and then run npm start
For me, it was because of the running Metro server. If anyone is experiencing this issue in react-native, make sure you have stopped the running Metro server instance before entering npm i <package-name>.
With yarn, I think, there's no such issue.
To resolve package.json file, go to your project folder and find package.json location folder.
Open terminal and make sure your are in correct path where package.json file located.
eg: c://projectfolder/folder1/clientapp> npm start
When running npm start, to start a react project I get the following messages on the terminal:
npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /Users/eraldomaia/package.json npm ERR! errno -2 npm ERR! enoent ENOENT: no such file or directory, open '/Users/eraldomaia/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent
npm ERR! A complete log of this run can be found in: npm ERR! /Users/eraldomaia/.npm/_logs/2020-02-29T15_23_08_741Z-debug.log
I do not know what to do!
How can I solve this?
You have to run npm start at root folder of your project (where de package.json resides).
This is because npm is unable to find package.json in the directory where you are running npm start. Make sure your current working directory is the one where the project is actually cloned / bootstrapped.
I am in my initial stages of learning react and have a limited understanding of npm manager and importing libraries into project.
For my current project, I had installed react-native using
npm install react-native
This also reflects in my package.json and node_modules folder
"react-native": "^0.61.5"
Now, when I try to import react-native as follows into AppCarousel.js
import React from 'react';
import {Dimensions} from 'react-native';
and then build the application , i get the following error message
.\src\Components\AppCarousel.js
Cannot find module: 'react-native'. Make sure this package is installed.
You can install this package by running: npm install react-native.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react#1.0.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react#1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\{USER}\AppData\Roaming\npm-cache\_logs\2020-01-09T13_08_54_364Z-debug.log
The terminal process terminated with exit code: 1
I tried referring to the the following questions i) link1 ii)link2
I cannot make out if this is a bug in npm or if there is a lack of understanding for installing packages on my side. Any help will be appreciated, thanks.
Terminal to kill the process:
ps -ax | grep npm
Then try to navigate to your directory in your terminal and try to do write this:
npm I react
or again:
npm i react-native
Simple explanation to get in use with TypeScript and React:
https://facebook.github.io/react-native/docs/typescript
I want to be able to test my app on Expo (an IPhone app used to test React Native code after you hit save) and I just can't seem to get past this error I'm getting Terminal. I've ran my app using Expo before with no problems but now after trying to include a Navigator in my app, I get an error.
First I did this:
$ npm i -g create-react-native-app
$ create-react-native-app my-project
$ cd my-project`
Then I wanted to include a Navigator in my app so I went ahead and did this:
npm install --save react-navigation
After that, in order to get Expo running I did:
npm start
When I do npm start, I get this error in Terminal:
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! Mestro#0.1.0 start: `react-native-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the Mestro#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
my guess would be that you are using npm5, I would recommend using npm4, npm5 is currently (as of june 17, 2017) very buggy. see this recommendation in the README.