fsevents not accessible from jest-haste-map - heroku

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

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.

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.

Try:
Deleting package-lock.json and node_modules
Running npm install locally, which should generate a new package-lock.json
Committing and pushing the new package-lock.json
I usually try this whenever I get strange npm errors like this relating to the dependencies.

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.

Related

I keep get empty directories after yarn add

I'm trying out yarn at the moment.
But, I'm having this "EPERM: operation not permitted, rmdir " issue every time I install a package.
For example,
yarn add express
> no errors for the first one
yarn add nodemon
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
error An unexpected error occurred: "EPERM: operation not permitted, rmdir 'D:\\GDrive\\dev\\mongoose_prac\\node_modules\\.bin'".
I have to remove all those empty directories to install new package. So I do know how to solve this issue. However, it seems like this is just a temporary answer. When I try to install a new one, then this error happens again with the exact same issue some directories same and some directories different from the empty ones before.
npm didn't had this issue before, and I just checked npm projects to see if those empty directories in yarn was also empty in npm. But, those bin directories in npm had some files in it.
So...
Does anyone know why I'm getting this empty directories after yarn add?
just to make it clear, I tried several times delete the whole workspace and make it again and initialize from the beginning.
and below is my package.json, yarn-error.log
{
"type": "module",
"name": "mongoose_prac",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "nodemon app.js"
},
"dependencies": {
"express": "^4.18.1",
"mongodb": "^4.10.0",
"mongoose": "^6.6.2"
},
"devDependencies": {
"nodemon": "^2.0.20"
}
}
since yarn-error.log has too many characters, i replace it with this code copy link here.
https://codefile.io/f/4wVUvpxykBYcEWhDbrTs

npm install task from package.json on Ansible Playbook fails to work [duplicate]

I'm trying to make a build a Docker image of a react application.
Here is the first part of the package.json:
{
"name": "front",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.14.1",
"#testing-library/react": "^11.2.7",
"#testing-library/user-event": "^12.8.3",
"eslint": "^7.29.0",
"html-react-parser": "^1.2.7",
"npm": "^6.14.4",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-input-mask": "^3.0.0-alpha.2",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.3",
"redux": "^4.1.0",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^2.0.3",
"web-vitals": "^1.1.2"
},
Here is the Dockerfile:
# pull official base image
FROM node:13.12.0-alpine
# set working directory
WORKDIR /app
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
ARG REACT_APP_BASEURL='https://localhost:8081'
ENV REACT_APP_BASEURL=$REACT_APP_BASEURL
# install app dependencies
COPY package.json ./
COPY package-lock.json ./
RUN npm install
# add app
COPY . ./
#EXPOSE
EXPOSE 3000
# start app
CMD ["npm", "start"]
So, I build with the command line:
docker build -f Dockerfile -t api_front .
and I've this error message:
npm WARN read-shrinkwrap This version of npm is compatible with
lockfileVersion#1, but package-lock.json was generated for
lockfileVersion#2. I'll try to do my best with it!
If I check the version of npm with npm -v , I've the latest one (7.19.1)
If I go to the project folder and I run npm install , everything is up-to-date
If I start the application with npm start , everything is ok and the api is running...
What is the problem?
Edit: SOLUTION
I've changed:
FROM node:13.12.0-alpine
to
FROM node:latest
The version of npm (v7.19.1) used to generate the package-lock.json file is newer than the version of npm (v6.14.4) inside the docker image of node 13.12.0.
1: The lockfile version used by npm v5 and v6.
2: The lockfile version used by npm v7, which is backwards compatible to v1 lockfiles.
You can read more about lockfile versions here
You can either upgrade the docker image to use the lastest version or downgrade your npm to generate a compatible package-lock.json
EDIT #1:
You have to replace the first line of your docker file with:
FROM node:16.4.2

How to run npm audit using the Task Runner Explorer?

I guess it is trivial, but I did not manage to figure out how to adjust my package.json so that I could run npm audit using the Task Runner Explorer by Mad Kirstensen within Visual Studio (Professional 2017).
My package.json starts with
{
"version": "1.4.6",
"name": "myProject.UI",
"private": true,
"scripts": {
"npm audit": "npm audit",
"webpack": "webpack -w --mode='development' --colors --config webpack.config.js",
}, ...
The 2nd entry in the section scripts works fine, the 1st one does not, since the Task Runner Explorer always adds a cmd.exe /c npm run as prefix to all scripts defined in package.json. This is what also what the error message says:
cmd.exe /c npm run npm audit --color=always
npm ERR! missing script: npm
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Me\AppData\Roaming\npm-cache\_logs\2020-04-01T01_23_45_6789Z-debug.log
How do I have to modify my package.json to be able to start a npm audit using the Task Runner Explorer?
Related
Can we able to run npm start from Visual Studio task runner explorer
No task runner configurations are found?
I'm afraid that in npm all script entries have a single string by design.
After all, package.json is just a json file and a such the "key" in the key/value pairs need to be a single valid string.
E.g. npm_audit instead of npm audit:
{
"version": "1.4.6",
"name": "myProject.UI",
"private": true,
"scripts": {
"npm_audit": "npm audit",
"webpack": "webpack -w --mode='development' --config webpack.config.js",
}, ...

VS2015's npm support can't deal with #types?

I just found out that VS2015 has support for npm even in normal ASP.NET 4 projects - that's great.
The first thing I tried after jquery was to get types:
{
"version": "1.0.0",
"name": "aspnet",
"private": true,
"devDependencies": {
"jquery": "3.1.1",
"#types/jquery": "^2.0.34"
}
}
This says
npm ERR! 404 'types/jquery' is not in the npm registry.
I know it is, because executing
npm install
in the directory of the package.json file then installs it correctly.
That's a bug in VS2015's npm support, right? Is there a fix?

laravel homestead and npm errors

Im using laravel homestead 0.5.0, I have a fresh install laravel but whenever i try to do npm install--no-bin-links or npm install on the VM or on Powershell or CMD it always give an error.
Maximum call stack size exceeded. windows max path length i guess? anything I can do to avoid this? heres my package.json
{
"private": true,
"scripts": {
"prod": "gulp --production",
"dev": "gulp watch"
},
"devDependencies": {
"gulp": "^3.9.1",
"laravel-elixir": "^5.0.0",
"bootstrap-sass": "^3.3.0"
}
}
im using windows 8.1 and virtual box 5
node version is 5.12.0
npm version is 3.10.5
any help is appreciated thanks
screenshot of the error

Resources