When I enter command npm start it generates ENOENT error - reactjs

I am new to ReactJs and firstly entered npx create-react-app my-app and after its installation, I entered npm start command. It says
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\Anonymous\OneDrive\Projects\react/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\Anonymous\OneDrive\Projects\react\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
enter image description here

You should run the command in my-app folder, where you probably have a package.json file.

Navigate to the directory where package.json exist in your project which has been created by create-react-app. Then try to run npm start
if you are in same directory, then try to run npm cache clean, and after this npm start.

Related

How can I get npx create-react-app to stop showing errors

I am trying to start a react project using npx create-react-app dashboard
It gives this error
npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path /home/<myfolder>/.npm/_cacache/tmp/33c12b20
npm ERR! dest /home/<myfolder>/.npm/_cacache/content-v2/sha512/9c/91/d37284418712530c020c5eb43e204d4f89773a3a9f79c057b3ec241e794e4ddffc99348c00616b947f45b22828a453247f2668c6cb43badfaf4br7dj
npm ERR! errno ENOENT
npm ERR! enoent Invalid response body while trying to fetch https://registry.npmjs.org/lilconfig: ENOENT: no such file or directory, rename '/home/<myfolder>/.npm/_cacache/tmp/33c12b20' -> '/home/i
<myfolder>/.npm/_cacache/content-v2/sha512/9c/91/d37284418712530c020c5eb43e204d4f89773a3a9f79c057b3ec241e794e4ddffc99348c00616b947f45b22828a453247f2668c6cb43badfaf4br7dj'
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! /home/<myfolder>/.npm/_logs/2022-07-11T04_03_23_264Z-debug-0.log`
I use npm 16.15.1 installed with nvm
Maybe you can try this way :
npm init
npm install -g create-react-app
after that, create your project :
npx create-react-app dashboard

Getting this error while running npm start in terminal vs code

Getting this error while running npm start in terminal vs code:
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\1 last try/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\1 last try\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! C:\Users\Acer\AppData\Local\npm-cache_logs\2021-12-13T12_38_55_514Z-debug.log
enter image description here
This error is likely due to a missing package.json file at your current directory. To create a new package.json in this directory, you can use npm init. It will prompt you for some metadata and automatically generate your package.json file.
I assume you are looking to run something similar to create-react-app based on the attempt to run the start script and the directory being named react-website-v1. In order to initialize a CRA site, the official documentation lists the commands for doing so as follows:
npx create-react-app my-app
cd my-app
npm start

Reactjs - npm start not opening in browser

I am following this tutorial to learn React. All is going smoothly until I run 'npm start', then I recieve this error message:
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\hwrobo\OneDrive\Desktop\Coursework\Week 13\reactTutorial/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\hwrobo\OneDrive\Desktop\Coursework\Week 13\reactTutorial\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! C:\Users\user\AppData\Local\npm-cache_logs\2021-09-08T13_49_13_202Z-debug.log
I'm not entirely sure what it means. Is it not able to find my folder?
This question may be helpful. npm install resulting in 'ENOENT: no such file or directory'
Seems like your problem could reside where you are running your npm install . You want to make sure your running the command in the same directory as the package.json file. Which is usually at the root of the project.

I cannot open a new project WebStorm React

I cannot open a new project at the WebStorm React JS.
WebStorm v 2020.3.2
Node v 15.0.1
I am starting a new project and I got this error.
"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npx-cli.js" --yes create-react-app .
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\projects\todo-new/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\projects\todo-
new\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! C:\Users\ivanh\AppData\Local\npm-cache\_logs\2021-03-08T18_52_52_706Z-debug.log
Done
I think the issue is that there is a space in your file name
no such file or directory, open 'C:\projects\todo- new\package.json'
if you look between todo- and new there is a space.
If you dont have a package.json file, run npm init to create one
I found a way. maybe it will help someone.
npm uninstall -g create-react-app
npm install -g npm#latest
deleted folder node_modules

Trying to run npm start command in Terminal

Everytime when i try to run npm start command this error comes, i tried to clear the npm cache still no luck, i am new to react js please help
C:\Users\Staff Member\Desktop\React\react>npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\Staff Member\Desktop\React\react\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\Staff Member\Desktop\React\react\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! C:\Users\Staff Member\AppData\Roaming\npm-cache\_logs\2020-09-02T03_34_33_868Z-debug.log
C:\Users\Staff Member\Desktop\React\react>
Open your CLI, and in the root folder of your directory run
npm init --yes
This will automatically create a package.json and insert default values that are taken from your current project

Resources