I'm trying to do
npm start
In my react project but always have a problem
npm ERR! path /Users/dan/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/dan/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and 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/dan/.npm/_logs/2018-04-11T17_50_33_041Z-debug.log
I've also know that 5 version of npm isn't the best. Because I've reinstall npm and now I've:
node -v
v8.11.1
npm -v
4.6.1
package.json
{
"name": "test",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.3.1",
"react-dom": "^16.3.1",
"react-scripts": "1.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
Try downgrade react-script
npm install react-scripts#2.1.8 --save
It's work for me!
Execute the following commands:
npx create-react-app myfirstreact
cd myfirstreact
npm start
It should work unless there are no files to work within the project.
Check if your react boilerplate template was fully generated by create-react-app otherwise you will need to upgrade your create-react-app
One way to know the template is not generated is if the src folder in your project directory does not exist.
your mistake is you are not in main file please run this command
cd-your file name
Related
I am new to react framework and I am trying to make a web app with the help of Tailwind CSS. it runs on the browser when I followed these steps :
npx create-react-app my-project
cd my-project
npm install -D tailwindcss#npm:#tailwindcss/postcss7-compat postcss#^7 autoprefixer#^9
npm install #craco/craco
npx tailwindcss-cli#latest init
npm start
but when I reopen the editor and run the command npm start in the terminal, the following error shows:
PS D:\react1> npm start
npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR! npm star # Mark your favorite packages
npm ERR! npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\DELL\AppData\Local\npm-cache\_logs\2021-07-12T09_16_22_570Z-debug.log
Please help me where i am wrong. I followed this page for the installation of react with tailwind
https://tailwindcss.com/docs/guides/create-react-app
Try
npm i react-scripts
npm start
First do npm i react-scripts after that replace the current scripts with this:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Then restart your visual studio code, and run in terminal: npm start
I got this error because I was not running the command npm start in a particular project directory.
Like my project was in: D://React/react1
and I was running the command in D://React
After making changes to the react application. I want to build the changes again and redeploy to IIS. but for a strange reason, the build is not working again. I have tried everything to rebuild but non has worked.
I tried
npm run build:prod
> project#0.1.0 build:prod C:\Users\MYNAME\source\repos\Project
> env-cmd -f .env.prod npm run build
npm ERR! missing script: build
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\MYNAME\AppData\Roaming\npm-cache\_logs\2021-04-19T13_38_22_516Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Project#0.1.0 build:prod: `env-cmd -f .env.prod npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Project#0.1.0 build:prod 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:
Here is the script part of my package.json
"scripts": {
"start": "env-cmd -f .env.dev react-scripts start",
"build:prod": "env-cmd -f .env.prod npm run build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
In "build:prod": "env-cmd -f .env.prod npm run build" the npm run build is missing. You have only start, build:prod, test, eject scripts, and no build exists.
I work on a React project within the Intellij IDE. But my project fails when I try to start it with npm start. The error code tells me that the critical point is the starting of the start script in the package.json.
I already tried the most often given advice here: reinstall node.js, node_modules. But this does not work for me.
Thank you already for looking at my problem.
Here is the error code in the terminal.
VXN5155:dhbw-engineering ThomasA$ npm start
> dhbw-engineering#0.1.0 start /Users/ThomasA/Desktop/Uni/3semester/Sw-:Webengineering/ProjektPraxisSwEngineering/dhbw-engineering
> react-scripts start
sh: react-scripts: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! dhbw-engineering#0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the dhbw-engineering#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:
npm ERR! /Users/ThomasA/.npm/_logs/2020-09-17T08_03_23_911Z-debug.log
Edit: Below are the scripts defined in the scripts section of my package.json:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Run chmod +x node_modules/.bin/react-scripts.
Then run npm start. It should work
I had same issue with npm start in react project just after create-react-app.
I fixed it by:
Creating .env file in my react app root directory.
Then adding SKIP_PREFLIGHT_CHECK=true to the .env file.
This fixed the problem.
Then npm start or yarn start it should work.
I want to run my project, but npm start error -_-
npm ERR! errno 1
npm ERR! breednder-project#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the breednder-project#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:
npm ERR! /home/aziz/.npm/_logs/2020-02-15T09_11_32_000Z-debug.log```
Did you try recovering your dependencies?
run npm install
and make sure from Node and npm version at least
npm more than 6 and node more than 10
npm -v
node -v
and finally, try to delete the node_modules and package-lock
and do npm i again
I had this issue before so I will share what my issue was:
in package.json just verify the integrity of you start command. Also try npm run start (add run to it)
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Your project lacks the necessary dependency to back the "start": "react-scripts start" clause under your package.json. To fix this error, just delete your node_modules folder and run npm install again.
I am trying to create reactjs apps and every time ,I install react-router-dom ,the web app shows error in terminal when I do npm start .
Here is the error
sh: 1: react-scripts: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! routeroute#0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the routeroute#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:
npm ERR! /home/rock/.npm/_logs/2019-03-16T10_04_47_549Z-debug.log
I tried doing rm -rf node_modules and then again installing but it doesn't seem to be working .
When I did npm install again ,
I got this error
npm ERR! path /home/rock/Desktop/routeroute/node_modules/browserslist/cli.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/home/rock/Desktop/routeroute/node_modules/browserslist/cli.js'
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/rock/.npm/_logs/2019-03-16T10_19_02_250Z-debug.log
Here is the dependecies for package.json
{
"name": "routeroute",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-router-dom": "^4.4.0",
"react-scripts": "2.1.8"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
You need to update your version of npm:
Try with this command: npm i -g npm
Or you can use this: npm install npm#latest -g