Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React npm start not working : 'No version of chokidar available'

I cloned my already working React-Typescript app on Github Pages, from Github and wanted to make some changes. I ran npm install and installed all the dependencies but when I run npm start, I got this error;

enter image description here

I don't know what chokidar is and I looked a little bit and I think it's unrelated to my project. Still I tried to npm install chokidar and I got another error like this;

enter image description here

Also tried npm audit fix as well. Fixed some stuff but nothing changed.

So I can't open the development server. Additionally, this is the package.json file;

// package.json {   "name": "panflix",   "homepage": "https://absolutezero13.github.io/meerkast/",   "version": "0.1.0",   "private": true,   "dependencies": {     "@testing-library/jest-dom": "^5.11.4",     "@testing-library/react": "^11.1.0",     "@testing-library/user-event": "^12.1.10",     "@types/enzyme": "^3.10.8",     "@types/jest": "^26.0.15",     "@types/node": "^12.0.0",     "@types/react": "^17.0.0",     "@types/react-dom": "^17.0.0",     "@types/redux-devtools": "^3.0.47",     "axios": "^0.21.1",     "enzyme": "^3.11.0",     "firebase": "^8.2.7",     "gh-pages": "^3.1.0",     "history": "^4.10.1",     "react": "^17.0.1",     "react-bootstrap": "^1.5.0",     "react-dom": "^17.0.1",     "react-redux": "^7.2.2",     "react-router-dom": "^5.2.0",     "react-scripts": "4.0.2",     "redux": "^4.0.5",     "redux-devtools-extension": "^2.13.8",     "redux-thunk": "^2.3.0",     "typescript": "^4.1.2",     "web-vitals": "^1.0.1"   },   "scripts": {     "predeploy": "npm run build",     "deploy": "gh-pages -d build",     "start": "react-scripts start",     "build": "react-scripts build",     "test": "react-scripts test",     "eject": "react-scripts eject"   },   "eslintConfig": {     "extends": [       "react-app",       "react-app/jest"     ]   },   "browserslist": {     "production": [       ">0.2%",       "not dead",       "not op_mini all"     ],     "development": [       "last 1 chrome version",       "last 1 firefox version",       "last 1 safari version"     ]   },   "devDependencies": {     "@types/react-redux": "^7.1.16",     "@types/react-router-dom": "^5.1.7"   } }   

I tried npm install -g chokidar and it is installed. But I'm getting the same error as before "no version chokidar is available."

Other react projects are working fine.

like image 966
İlker Avatar asked Mar 21 '21 16:03

İlker


People also ask

How do I update Chokidar?

Update chokidar by doing rm -rf node_modules package-lock. json yarn. lock && npm install , or update your dependency that uses chokidar.

How npm start works in react?

With the start argument, NPM will begin the process to make a development server available for your React application. Here's a list of tasks for this script: Set the build environment into development for Node and Babel. Ensure environment variables are read for the build process.


1 Answers

I had the same issue. What worked for me is forcing updates on local npm packages:

npm update --force 

Before

$ npm list chokidar [email protected] └─┬ [email protected]   └─┬ [email protected]     └── [email protected] 

After

$ npm list chokidar [email protected] └─┬ [email protected]   ├─┬ [email protected]   │ └── [email protected]   └─┬ [email protected]     └─┬ [email protected]       ├── [email protected]       └─┬ [email protected]         └── [email protected] 

Update

We found that NPM 7 was the issue. Downgrading to NPM 6.14.12 works without any changes.

like image 195
dieselcz Avatar answered Oct 02 '22 16:10

dieselcz