Has anyone ever come across this issue?
When using react-scripts start, everything seems ok on first load. As soon as a change is made to a file, all the mouse event seem to stop working (can't click on buttons, inputs, no tooltips etc.), even though the browser appears to update.
If I refresh the page the events work again, until a file is changed.
This isn't a problem in production as the watcher isn't involved there.
Any ideas?
EDIT:
I've found the problem but I'm not sure what the solution is.
It appears that a iFrame is added to the DOM when the watcher reloads. It looks like it has something to do with licenses. The body within the iFrame is empty but there is some minified JS with a comment on the top line:
/*! For license information please see iframe-bundle.js.LICENSE.txt */
Does anyone know how to prevent this iFrame appearing.
This is what fixed it for me:
npm upgrade react-scripts
This works for me:
"react-error-overlay": "6.0.9",
and add the fixed dependency version to the resolutions section of your package.json:
"resolutions": {
"//": "See https://github.com/facebook/create-react-app/issues/11773",
"react-error-overlay": "6.0.9"
},
Notice: please put this dependency into "resolutions":{ } of package.json. It won't work in "devDependencies" or "dependencies" .
You need to upgrade React-Scripts to latest version
npm install react-scripts#latest
My solution npm install --save --save-exact react-scripts#5.0.0 then rm -rf node_module && rm -rf package-lock.json y then npm install and npm start =)
Upgrading to react-scripts v5 that way made it work for me :
npm i react-scripts#5.0.0
Related
Warning
(6:29521) autoprefixer: Replace color-adjust to print-color-adjust. The color-adjust shorthand is currently deprecated.
Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.
WARNING in ./node_modules/bootstrap/dist/css/bootstrap.min.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/bootstrap/dist/css/bootstrap.min.css)
Module Warning (from ./node_modules/postcss-loader/dist/cjs.js):
I encounter this warning while running react-bootstrap(v2.3.1 (Bootstrap 5.1)) with reactjs(v18.1.0). How to solve the problem?
You can add it into package.json
First Step
"resolutions": {
"autoprefixer": "10.4.5"
},
Second Step
yarn install
** If you are using npm
First Step
"overrides": {
"autoprefixer": "10.4.5"
},
Second Step
npm install
** Summarize from https://github.com/twbs/bootstrap/issues/36259#issuecomment-1114855186
Bump bootstrap to 5.2.0 or newer.
Bootstrap 5.1.3 still has this problem.
As I'm typing this, the latest bootstrap 5.2.0 version is 5.2.0-beta1, which given its beta status may or may not be something you want to upgrade to, but upgrading to that will at least solve this problem.
The root cause here is that bootstrap generates CSS with deprecated tags. Notice how your error message implicates bootstrap:
WARNING in ./node_modules/bootstrap/dist/css/bootstrap.min.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/bootstrap/dist/css/bootstrap.min.css)
This problem still exists for me even upgrading to bootstrap 5.2.0-beta1 and upon inspection of the installed bootstrap it appears to be using latest autoprefixer. I see no solution currently. If there is a way to create a js/tsx file to override that would be nice.
Simply setting overrides didn't work for me. I had do go through the following steps :
Add this to package.json:
"overrides": { "autoprefixer": "10.4.5" }
Delete package-lock.json
Delete the node_modules/ directory
Run npm install to install the npm modules back
Go to bootstrap.css or bootstrap.min.css, in my case is bootstrap.min.css
ctrl+F or find text -webkit-print-color-adjust:exact;color-adjust:exact
change the color-adjust to print-color-adjust
problem solved
Whenever I make a save and React hot reloads the app, an iframe with a high z-index gets injected which makes the UI un-clickable.
I have to either open up dev tools and delete the element OR I have to refresh the UI for things to work correctly again.
If I delete the dom element, it doesn't attempt to add again into the UI unless I refresh and there's another hot reload. Using incognito or no extensions gives the same result.
To solve this issue you need to add the following to your package.json file:
"resolutions": {
"react-error-overlay": "6.0.9"
},
Then install react-error-overlay as a dev dependency with npm i --save-dev react-error-overlay#v6.0.9. Then remove your node_modules folder and package-lock.json file. Run npm install and check if that works.
If the issue is not resolved, run npm install react-error-overlay#6.0.9 again it will solve the issue. More information is available here.
All of a sudden I started getting this error when I type
npx create-react-app project
The error is :
Invalid "exports" main target "index.js" defined in the package config /home/swaraj/.npm/_npx/8451/lib/node_modules/create-react-app/node_modules/is-promise/package.json
Can anybody tell me what's this error and how to resolve it
This must mean that your package.json is broken.
I just had the same problem, and it fixed for me when I recreated/edited the package.json it is trying to access.
Type yarn init -y and read the package.json
Add the following lines:
"resolutions": {
"is-promse": "2.1.0",
"run-async/is-promise": "2.1.0"
}
Afterwards do yarn add --dev create-react-app and then try to compile your reactjs application using:
yarn create-react-app <PATH/APP-NAME>
I would also recommend trying to manually remove is-promise property. I think the command for that was called npm remove is-promise, but I am not sure.
But I am pretty sure that your package.json needs a fix :)
Reply if it didn't work, I'll try to find a different way-around then.
If that solution doesn't work try installing node version 12.12.0 and running create-react-app again.
There are issues with the promise dependency being worked on at the moment. Issue
Do not downgrade your node version. Downgrading was a temporary solution, as for now, this issue is fixed with 2.2.2 version of is-promise package. If you still experience problems creating new CRA, consider npm install -g --force create-react-app
If even then bug is still present, please comment your issue to this github issue
I created a React project using npx create-react-app my-app command. I then tested the project using npm start. When I commit the project to Github, I get a security advisory in the project page.
serialize-javascript vulnerability found in yarn.lock
**Remediation**
Upgrade serialize-javascript to version 2.1.1 or later.
I do not have the serialize-javascript dependency in my package.json file. Here is the project in Github - https://github.com/shankarps/ReactPracticeProject/
How can i fix this error?
How can i ensure that the latest dependencies are included in the project when it is created?
This GitHub issue has a pretty good conversation on this:
https://github.com/yarnpkg/yarn/issues/4986
"The workaround of adding sub-dep A as a direct dep just to fix a security issue is worse because it creates confusion (the package is not used directly) as well as a maintenance burden." - kumar303
As a couple others have suggested, adding a resolutions field to your package.json file might be more ideal.
"resolutions": {
"serialize-javascript": "^2.1.1"
}
I had the same issue Reported by GitHub for my React app created by npx create-react-app:
Here is what I did to resolve this security alert for serialize-javascript to do with yarn.lock.
yarn add serialize-javascript
And then git commit and push the changes of package.json and yarn.lock to GitHub. As a result, the alert was gone.
Just put the serialize-javascript in the resolutions inside package.json so you can force it to use the last update. then run yarn upgrade.
Same issue occurred me, tried below ways and worked
1) yarn add serialize-javascript
git add .
git commit -m "Message here"
git push origin master
2) Add resolutions in package.json file
"resolutions": { "serialize-javascript": "^2.1.1" }
and try yarn upgrade
From https://github.com/facebook/react/issues/17559#issuecomment-563457352
There's nothing about React apps that requires the use of this plugin. It's just something being used by react-scripts/Webpack.
One partial solution is to add the yarn.lock file to the .gitignore. That way the alert will not be shown.
I have an issue that I cannot solve.
I'm using ESLint in VSCode for my all projects.
Now I created a new react app but when I run it (npm start or yarn start), it throws an error.
React app use ESLint 5.12.5, is lower version of mine.
I tried following the steps in the suggestion but ... it's not fixed.
Can anyone solve my issue?
I tried npm uninstall -g eslint, npm uninstall eslint, npm i ...bla..bla, removed my ESLint extension in my VSCode, and re-created react app. But the error has not been fixed.
I checked eslint -v, it said 5.14.1, but in the error notice, vscode said version 5.16.0 is in node-modules ##.
This is full error notice when I try yarn start or npm start:
> homework02#0.1.0 start E:\Extenal Code\Hoc JS\ReactJS-iViettech\homework02
> react-scripts start
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"eslint": "5.12.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of eslint was detected higher up in the tree:
E:\Extenal Code\Hoc JS\node_modules\eslint (version: 5.16.0)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
6. Check if E:\Extenal Code\Hoc JS\node_modules\eslint is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls eslint in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed eslint.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
I just solved this issue, the error says:
The react-scripts package provided by Create React App requires a dependency:
"eslint": "5.12.0" (in my case "^5.16.0")
but also says you have another version at package.json that's
E:\Extenal Code\Hoc JS\node_modules\eslint (version: 5.16.0) in my case was 6.1.0
so my solution was:
I searched for the dependency called eslint and updated the version similar to Create React App expected "eslint": "^5.12.0" (in my case "eslint": "^5.16.0") at package.json
Then run npm install and now you can run npm start... if you have troubles with slint-plugin-import just update the version as well, additional you can try installing locally instead of global with --save.
I believe this is an ongoing issue with create-react-app and eslint as detailed at:
https://github.com/wesbos/eslint-config-wesbos/issues/17
There are a number of suggestions there, though I'm hoping they will put a more permanent fix in place.
In my case it works like below:
Create New Project or clone form vcs.
Create .eslintrc.json file by yourself. Do not use Ctrl+Shift+P ->Eslint:create eslint configuration.
Try searching for eslint and change the version to the required version in the package.json file of eslint. 5.12.0 in your case.
Just try clearing cache and everything will come into normal usage you can use npx create-react-app project-folder-name, this worked for me.
Use this cmd in your terminal
cmd -> npm cache clean —force
there is different process to make it work just have to follow two installations for the future projects too if you like you can use this too and can work for your projects, cmd line is mentioned below :
cmd 1-> create-react-app my-app --scripts-version #nomoreanalog/react-scripts-eslintless
cmd 2-> npm install --save-dev babel-plugin-styled-components