fsevents not accessible from jest-haste-map

When i deploy my app from github.com to heroku. I get the following message error: fsevents not accessible from jest-haste-map.

Could you help me solve this issue. This is my package.json

{ "name": "app-clean", "version": "0.1.0", "private": true, "main": "index.js", "dependencies": { "@reduxjs/toolkit": "^1.6.0", "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", "bootstrap": "^5.0.1", "bootstrap-icons": "^1.5.0", "json-server": "^0.16.3", "react": "^17.0.2", "react-dom": "^17.0.2", "react-redux": "^7.2.4", "react-scripts": "4.0.3", "web-vitals": "^1.0.1" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "server": "json-server db.json -p 5000 -w -d 0" }, "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" ] }
}

Thanks

1

6 Answers

So it seems that there are some internal dependencies that depend on the fsevents module. The general consensus seems to be to make this dependency optional, which should fix your problem (on Windows at least).

Try:

npm i fsevents@latest -f --save-optional

That fixed the dependency issue for me.

2

I have the same issue with the GitHub Actions (is being used for style-checking and testing).

The error message appears while executing command npm ci:

fsevents not accessible from jest-haste-map

If I replace the npm ci by npm install, I receive the error about the lockfile version:

This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2

Therefore, the reason of the issue is upgraded lockfile version to 2.

If you have the same issue, check the npm version (command) and package-lock.json (file). If the "lockfileVersion" is 2, npm must be at least 7.x.

To fix that in GitHub action I added npm-upgrading step. So, my steps looks like:

 # ... steps: # ... - name: Upgrade NPM run: npm install -g npm - name: Install dependencies run: npm ci - name: Build project run: npm run build

Thus, if you have issue like "it works on my PC, but does not work in CI/CD runner", try to use described solution.

2

Try:

  1. Deleting package-lock.json and node_modules
  2. Running npm install locally, which should generate a new package-lock.json
  3. Committing and pushing the new package-lock.json

I usually try this whenever I get strange npm errors like this relating to the dependencies.

1

I had this problem in bitbucket.org pipelines.

We was using Docker image with Node in version 14.17.0 (npm was included in version 6.14.13).

Updating only npm to version 8.1.3 did not help.

But updating Docker image of Node to new LTS version (16.13.0, with npm 8.1.0) fixed this problem and npm ci started working properly.

I saw this error this week. I changed package versions, then the error has gone. Here are my versions that seem related to this error. I'm not sure this is the correct way to fix it.

"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^13.1.9"

The same issue happen to me when build the package using ./github/worflows

Run npm ci npm ERR! fsevents not accessible from jest-haste-map

1 - To resolve, I install in my local: npm i fsevents@latest -f --save-optional

2 - Push the package.json into github again. The workflows(view from github repository-> tab Actions) is triggered, the result shows the build is success.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like