Could not find plugin "proposal-class-properties" [duplicate] - reactjs

How to fix Could not find plugin "proposal-numeric-separator", I get this error when I try to build my React application, I have not ejected the application yet:
./src/index.js
Error: [BABEL] /home/pc/Downloads/project/src/index.js: Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "/home/pc/Downloads/project/node_modules/babel-preset-react-app/index.js$0")
at Array.map (<anonymous>)
at Generator.next (<anonymous>)
at Generator.next (<anonymous>)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I have tried to download Babel and the dependency Proposal Numeric Separator, remove the Node Modules, clean the Yarn cache; but nothing worked.
I'm using Yarn 1.22.4 and Node 13.11.0, but I have also tried with NPM 6.13.7.

The following steps work:
Add the following line to package.json:
"resolutions": {
"#babel/preset-env": "7.5.5"
},
Run the following command:
$ npx npm-force-resolutions
Install dependencies:
$ npm install
# or
$ yarn
Build your project:
$ yarn build
Take a look at this Github Issue

Try this, it works: npm i #babel/compat-data#7.8.0
I have just used it like 10 minutes ago, and it's working fine.
Related issue going on github about this. Click Here!

From the corresponding issue in create-react-app,
Update react-scripts to 3.4.1 in your package.json file and remove
node_modules as well as package-lock.json/yarn.lock and re-install.

Why this problem happened?:
It's an issue of conflicts between internal packages used by babel.
Adding a new plugin to #babel/compat-data breaks old #babel/preset-env versions. This is because preset-env iterates over compat-data's plugins, and throws if the plugin isn't defined in preset-env's available-plugins.js file.
This is the merge that fixed the issue: https://github.com/babel/babel/pull/11201/files/a88a00750c61ff89f1622d408d67108719f21ecd
Solution:
Delete package-lock.json or yarn.lock
Delete node_modules folder
In package.jon I have adjusted the version numbers of these packages to:
...
"devDependencies": {
"#babel/compat-data": "^7.8.0",
"#babel/preset-env": "^7.8.0",
"babel-loader": "^8.1.0",
...
},
...
"resolutions": {
"#babel/preset-env": "^7.8.0"
}
Run npm install
Run npm run build

Reference: https://github.com/angular/angular-cli/issues/17262
I found two solution
a ) Install babel compat
"devDependencies": {
"#babel/compat-data": "7.8.0",
}
b) Install plugin-proposal-numeric-separator
npm install --save-dev #babel/plugin-proposal-numeric-separator
install this version only 7.8.0
Angular CLI can create this kind of issue. Go to package json and change it to
build-angular": "0.803.17"
please don't add ^ or ~ .

I faced similar issue and i was able to fix it by updating all babel dependencies to latest version. I'm not aware of the exact issue with babel. However, the below mentioned step worked for me.
Step 1: identify and remove all babel related dependencies from package.json
npm remove #babel/runtime #babel/core #babel/plugin-proposal-class-properties #babel/plugin-transform-modules-commonjs #babel/plugin-transform-runtime #babel/preset-env #babel/preset-react babel-eslint babel-jest babel-loader
Step 2: re-install babel dependencies
npm install --save #babel/runtime
npm install --save-dev #babel/core #babel/plugin-proposal-class-properties #babel/plugin-transform-modules-commonjs #babel/plugin-transform-runtime #babel/preset-env #babel/preset-react babel-eslint babel-jest babel-loader
PS: The above list of babel dependencies will differ for your project.

I just changed react-script version from 3.0.1 to 3.4.1

You can use this command, which has worked for me.
npm i #babel/compat-data#7.8.0

I'm using angular & this worked for me, simply changed the version of #babel/compat-data from ^7.8.0 to just 7.8.0, the package-lock.json is having newer version which has bugs.
Inside package.json:
"devDependencies": {
"#babel/compat-data": "7.8.0",
}

In package.json
"dependencies": {
"#babel/compat-data": "7.8.0",
"#babel/plugin-proposal-numeric-separator": "^7.8.3",
"babel-loader": "^8.1.0",
....
"resolutions": {
"#babel/preset-env": "^7.8.7"
}
it is working for me. You can read more
https://github.com/angular/angular-cli/issues/17262#issuecomment-603396857

Its just a 4 step process.
Reason:
This happens because of a package missing in babel. This will happen even if you create angular app using ng new command.
Solution
Install plugin-proposal-numeric-separator using the following code in terminal.
npm install --save #babel/plugin-proposal-numeric-separator
Once it is done navigate to the file as shown below.
node_modules > #babel > preset-env > available-plugins.js
In available-plugins.js below exports.default = void 0; copy and paste the following code.
var _pluginProposalNumericSeparator = _interopRequireDefault(require("#babel/plugin-proposal-numeric-separator"));
In available-plugins.js within var _default object declaration copy and paste the following code.
"proposal-numeric-separator": _pluginProposalNumericSeparator.default,
And it is done.

In my angular 8 application, although I did not have any direct dependancy of react-scripts package and did not have it in package.json either but started getting this error on build. It was likely used as a depedancy by other packges.
By reading this post on github, I added it as dependancy in package.json "react-scripts": "3.4.1" and run npm install the build started working just fine.

This worked for me:
Delete package-lock.json
Delete node_modules
Run npm i

try this , this working with me .
npm i #babel/compat-data#7.8.0

Add SKIP_PREFLIGHT_CHECK=true to .env file to make the build work without ejecting and follow the below steps:
Delete node_modules and package-lock.json
Add "resolutions": { "#babel/preset-env": "^7.8.7" } to package.json
Run npm install npm-force-resolutions --save-dev
Run npm install
Run npx npm-force-resolutions
Run npm install again
Run npm run build

In my case I've got a corrupted node_modules folder.
My yarn install simply stopped in the middle by a power surge.
By running:
rm -rf node_modules
yarn
My problem was solved.

worked for me.
npm install #babel/compat-data#~7.8.0

I just had this happen to me. The To fix it I ran yarn build with sudo privileges.

Related

How do I downgrade react-scripts 5.0.1 to 4.0.3

I'm having the issue that's faced in this question: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema
One of the solutions is to downgrade react-scripts to 4.0.3 and I'm not sure how to do that. Could someone help me?
Could always delete your node_modules directory and change the version in your package.json under dependencies:
"dependencies": {
"react-scripts" :"5.0.1",
}
then run an install. It's better to do a terminal approach when looking to change versions of a package, like:
NPM
uninstall:
npm uninstall react-scripts
install:
npm install --save react-scripts#4.0.3
Yarn
since Yarn is the preferred for Create React App per memory:
uninstall:
yarn remove react-scripts
install:
yarn add react-scripts#4.0.3
You have at least 2 options.
First, in your project folder you run the following command:
npm i react-scripts#4.0.3
Source: https://www.npmjs.com/package/react-scripts/v/4.0.3?activeTab=versions
Second, you open your package.json file in your project and change the version number of react-scripts to 4.0.3
"dependencies": {
"react-scripts" :"4.0.3",
...
}
and run npm i.
This will upgrade or downgrade everything to the version that are stated in your package.json file.

reactjs. Error: Node Sass version 7.0.1 is incompatible with ^4.0.0 [duplicate]

I've created a blank React project, using the command: npx create-react-app on npm v7.0.7 and Node.js v15.0.1
Installed:
React v17.0.1,
node-sass v5.0.0,
Then I tried to import a blank .scss file to the App component:
File App.js
import './App.scss'
function App() {
return (
<div className="App">
App
</div>
);
}
export default App;
It throws an error:
Failed to compile.
./src/App.scss (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-6-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--5-oneOf-6-3!./node_modules/s
ass-loader/dist/cjs.js??ref--5-oneOf-6-4!./src/App.scss)
Error: Node Sass version 5.0.0 is incompatible with ^4.0.0.
File package.json
{
"name": "react-17-node-sass-5",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.11.5",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"node-sass": "^5.0.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.0",
"web-vitals": "^0.2.4"
},
...
}
}
TL;DR
npm uninstall node-sass
npm install sass
Or, if using Yarn
yarn remove node-sass
yarn add sass
Edit3: yes, another edit. Moving to sass (dart-sass) is the best solution. Previous one included locking node-sass to version 4.x.x, which is 2 years old and lacks newer SCSS features.
Edit2: sass-loader v10.0.5 fixes it. The problem is you might not be using it as a project dependency, but more as a dependency of your dependencies. CRA uses a fixed version, angular-cli locks to node-sass v4, and so on.
The recommendation for now is: if you're installing just node-sass, check the below workaround (and the note). If you're working on a blank project and you can manage your Webpack configuration (not using CRA or a CLI to scaffold your project), install the latest sass-loader.
Edit: this error comes from sass-loader. There is a semantic versioning mismatch since node-sass #latest is v5.0.0 and sass-loader expects ^4.0.0.
There is an open issue on their repository with an associated fix that needs to be reviewed. Until then, refer to the solution below.
Workaround: don't install node-sass 5.0.0 yet (the major version was just bumped).
Uninstall node-sass
npm uninstall node-sass
Then install the latest version (before 5.0)
npm install node-sass#4.14.1
Note: LibSass (hence node-sass as well) is deprecated and dart-sass is the recommended implementation. You can use sass instead, which is a Node.js distribution of dart-sass compiled to pure JavaScript.
The only one reason why you get some error like that, is because your Node.js version is not compatible with your node-sass version.
So, make sure to checkout the documentation at node-sass.
Or this image below will be help you in deciding what Node.js version can use the node-sass version.
For an example, if you're using Node.js version 12 on your Windows system ("maybe"), then you should have to install the node-sass version 4.12.
npm install node-sass#4.12
Yeah, like that. So now you only need to install the node-sass version recommended by the node-sass team with Node.js version installed on your computer.
Uninstall node-sass:
npm uninstall node-sass
Use sass by:
npm install -g sass
npm install --save-dev sass
node-sass aka LibSass is officially deprecated as of October 26 2020 and instead you should use sass aka Dart Sass.
For npm you could do:
npm uninstall node-sass
npm install sass --save-dev
For yarn do:
yarn remove node-sass
yarn add sass
The best solution for me was uninstalling node-sass.
npm uninstall node-sass
then install sass:
npm install sass
For those using Yarn:
yarn remove node-sass
yarn add sass
If you happen to use CRA with the default Yarn package manager, use the following. It worked for me.
yarn remove node-sass
yarn add node-sass#4.14.1
Using npm,
npm uninstall node-sass
npm install node-sass
change the "react-scripts": "4.0.0" into "react-scripts": "4.0.3" in package.json and save
npm install
npm start
or, using yarn -
yarn remove node-sass
yarn add --dev node-sass
as above
yarn install
yarn start
This is version problem. Install the right dependent version:
npm uninstall node-sass
npm install node-sass#4.14.1
According to the Edit2 of Nicolas Hevia telling that
sass-loader v10.0.5 fixes it
I launched this command:
npm install sass-loader#^10.0.5 node-sass --save-dev
That fixed my issue.
Be aware that I am in a development environment. In other cases, the option --save-dev should be removed.
It worked for me after adding a particular version of the node-sass package (node-sass#4.14.1).
You can just switch to Sass since node-sass is deprecated now anyway.
In your package.json file:
"node-sass": "npm:sass#^1.49.9",
React still asks for node-sass after removing it and replacing it with Sass, so you can alias it like this and now React will use Sass.
I met the same issue, and here's how I was able to fix it:
Firstly, you have to know which node-sass version you are using in your project. Then go upgrade or downgrade your current Node.js version to the compatible version with your current node-sass version, you can know that from this link.
Of course, stop the server, and close your IDE.
So, the best way to upgrade or downgrade the Node.js version, has mentioned above in this answer. Then remove the node_modules, and package-lock.json and install again... You can do it as such:
npm cache clean --force
rm -rf /node_modules package-lock.json
npm install
npm audit fix
npm run <your_script_name>
If the error is
Error: Node Sass version 5.0.0 is incompatible with ^4.0.0
Step 1: stop the server
Step 2: run commands are npm uninstall node-sass
Step 3: check node-sass in package.json. If node-sass is available in the file then again run Step 2.
Step 4: npm install node-sass#4.14.1 <=== run command
Step 5: wait until the command successfully runs.
Step 6: start-server using npm start
Just change version to:
"version": "4.14.1" in your package.json file
Adding sass-loader as as dev-dependency solved this for me.
"devDependencies": { "node-sass": "^6.0.0", "sass-loader": "^11.1.1" }
Small update: In case if you get the below error in regard to node-sass, follow the steps given below.
code EPERM
npm ERR! syscall unlink
Steps to solve the issue:
Close Visual Studio
Manually remove .node-sass.DELETE from node_modules
open Visual Studio
npm cache verify
npm install node-sass#4.14.1
Delete a yarn.lock file in the project
and
yarn remove node-sass
yarn add node-sass
In app.js or wherever the css is being imported, make sure to import css and not scss. The script in package.json will create a css file and that's what should be imported.
"scss": "node-sass --watch -include-path src/scss -o src/css"
This script will watch a scss file inside of a folder called scss that is inside src. It will then create an css folder inside src and add a css file inside that folder, this is the file you should import in app.js
To run the script:
npm run scss
File structure example:
src/scss/styles.scss
CSS file created by script:
src/css/styles.css
Or else Rebuild your node-sass so that the compatibility does not produce an error.
When the incompatibility between node-sass and node occurs, you will get typescript errors .
Do this to achieve node-sass compatibility.
npm rebuild node-sass
This error is due to an incompatible version of the sass loader with node-sass.
Add these dependencies at the end of your package.json file.
Note: You can google to check which sass-loader version is compatible with your node-sass version.
"devDependencies": {
"node-sass": "^6.0.1",
"sass-loader": "^10.2.0"
}
Please note that Node Sass is deprecated and you may replace it with Dart Sass:
Warning: LibSass and Node Sass are deprecated. While they will continue to receive maintenance releases indefinitely, there are no plans to add additional features or compatibility with any new CSS or Sass features. Projects that still use it should move onto Dart Sass.
Source: node-sass
The below recipe helped me:
Uninstall node-sass:
npm: npm uninstall node-sass
yarn: yarn remove node-sass
Uninstall sass-loader:
npm: npm uninstall sass-loader
yarn: yarn remove sass-loader
Install Dart Sass as a development dependency
npm: npm install sass -dev
yarn: yarn add sass -dev
Before building, you should also:
Remove the node_modules directory
Remove lock file:
npm: Remove package-lock.json
yarn: Remove yarn.json
npm uninstall node-sass
npm i sass
Steps to resolve this issue:
Go to your node_module folder and open node-sass modules.
In the package.json file inside node-sass, change the version from "5.0.0" to "4.14.1".
Finally in the package.json at the root of the main project again change node-sass version from "5.0.0" to "4.14.4."
This should work.

Problems with installing SASS React

I want to install SASS to my react app.
I try yarn add node-sass my console return error:
./src/comopnents/Form/Form.scss (./node_modules/css-loader??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/lib/loader.js!./src/comopnents/Form/Form.scss)
Node Sass version 7.0.1 is incompatible with ^4.0.0.
I found advice to uninstall node-sass and install sass. I did it, but then I have got this error:
../src/comopnents/Form/Form.scss (./node_modules/css-loader??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/lib/loader.js!./src/comopnents/Form/Form.scss) To import Sass files, you first need to install node-sass. Run npm install node-sass or yarn add node-sass inside your workspace. Require stack:
/Users/madlen/(...)/node_modules/sass-loader/lib/loader.js
/Users/madlen/(...)/node_modules/loader-runner/lib/loadLoader.js
/Users/madlen/(...)/node_modules/loader-runner/lib/LoaderRunner.js
/Users/(...)/node_modules/webpack/lib/NormalModule.js
/Users/(...)/node_modules/webpack/lib/NormalModuleFactory.js
/Users/(...)/node_modules/webpack/lib/Compiler.js
/Users/(...)/node_modules/webpack/lib/webpack.js
/Users/(...)/node_modules/react-scripts/scripts/start.js
I try to upgrate yarn, add sass-loader, nothing helps
Do this in your package json
"node-sass": "npm:sass#^1.49.9",
React still asks for node-sass after removing it and replacing with sass so you can alias it like this and now react will use sass
Maybe try updating your project's react-scripts, as doing so fixed the issue for me.
I was having the same issue - saw advice elsewhere to switch node-sass out for sass, and then had the same errors mentioned in the OP. Tried Mark O's solution to alias sass, which worked. However, then I tried setting up absolute imports in my project (with jsconfig.json in the way described here), and that was mysteriously failing too.
I then realized that my project had a very old version of react-scripts for some reason, as it was on 2.x.x. So I swapped react-scripts in my package.json to be "react-scripts": "4.0.3", ran npm install, did npm run start and now absolute imports work. I then tried using sass instead of node-sass again and that works too (npm uninstall node-sass, then npm install sass).
try stopping the current development server, and install node-sass again.
I was having similar problem. These steps fixed my problem.
Delete node_modules rm -rf node_modules
Delete package-lock.json rm package-lock.json
Run npm install or yarn install
I am using;
node-sass: ^6.0.1
npm: 7.24.2
node: v16.13.0

Problems with babel loader in react-create-app

The Problem
create-react-app initializes a repository where babel-loader is installed as an older version than needed.
LOG:
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:
"babel-loader": "8.0.4"
Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-loader was detected higher up in the tree:
C:\Users\user\node_modules\babel-loader (version: 8.0.2)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If 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 "babel-loader" 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 C:\Users\User\node_modules\babel-loader is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls babel-loader in your project folder.
This will tell you which other package
(apart from the expected react-scripts) installed babel-loader.
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.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reg#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reg#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! C:\Users\User\AppData\Roaming\npm-cache\_logs\2018-12-13T18_22_47_802Z-debug.log
After what it happened
$ npx create-react-app reg && cd reg && npm start
What I've tried
I tried to remove node_modules folder and package-lock.json, then run npm install.
Also installed yarn and ran yarn && yarn start.
I've recreated the app 3 times and got the same result.
Info that may be helpful
Node version: 10.8.0
NPM Version: 6.5.0
create-react-app / react-scripts: 2.1.1
babel-loader: 8.0.4
Global packages list (npm ls --depth=0 -g):
+-- create-react-app#2.1.1
+-- node-gyp#3.6.2
+-- npm#6.5.0
+-- yarn#1.12.3
package.json file:
{
"name": "reg",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-scripts": "2.1.1"
},
"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"
]
}
Getting the same issue but given an hour on it get the solution
When we run npm start then you got this kind of an error that is version related issues for this issue.
Go to node_modules folder:
Project->node_modules->react-scripts->package.json
check the package.json file
there you got : "babel-loader": "8.0.4"
first remove : babel-loader folder for Project->node_modules->babel-loader
and then run npm i babel-loader#8.0.4 (it is depend on your version you can change it like : npm i babel-loader#8.0.5) after that may be you got webpack issue then follow same thing remvoe webpack from "Project->node_modules->webpack"
and reinstall npm i webpack#4.19.1
4.19.1* webpack's version it may be change..
Create a .env file in your project directory and include SKIP_PREFLIGHT_CHECK=true in the file.
On Mac:
Remove the conflicting package from /Users/<yourusername>/node_modules
However, a different version of babel-loader was detected higher up in the tree:
You should delete babel-loader package that was was detected higher up the tree. The output says there is a node_modules folder with babel-loader at..
C:\Users\user\node_modules\babel-loader (version: 8.0.2)
You may be able to delete the C:\Users\user\node_modules directory altogether as well, unless for some reason you have a project rooted there inside /Users/{user}
A few years later, the same issue.
For me, the solution was in my c:/users/myName/node_modules.
Remove that node_modules completely and try again.
You can momentarily downgrade react-scripts to 1.1.5 in the package.json file, then remove the node_modules folder and in the case of using NPM delete the package-lock.json file and in case Yarn delete the file yarn.lock.
After that, reinstall the dependencies and start the development server with the yarn start or npm run start command.
this means you install tow babel-loader
rm yarn.lock
run npm uninstall babel-loader#8.0.4
I got the same problem.
I solved it by removing folder node_modules in User/ and file package-lock.json (if exists).
It should work perfectly then.
I had this exact same issue. For anyone who finds this thread via Google and is a beginner like me. Here is exactly what to enter into your terminal(Mac User).
Say you're getting the same error that Paul was getting:
"The react-scripts package provided by Create React App requires a dependency:
"babel-loader": "8.0.6"
Here's what I entered into the terminal. I could be wrong, but this is what worked for me (I am also a beginner):
Step 1: Delete the node_modules folder as well as the package_lock.json files.
Step 2: In your terminal, type cd - (we're just getting outside of our project folder and going into your home folder)
Step 3: In your terminal type in npm i "dependency-name#number" so for the above example it would be: npm i babel-loader#8.0.6
Step 4: Now in your terminal, navigate into your project folder and type: npm install or yarn install
Step 5: Try running npm start and if all the issues have been solved, it should start the development server.
Note: I had to do the above process twice, for babel-loader#8.0.6 as well as for Webpack.
I have also problems after creating an app-project using the following commands:
create-react-app "project name"
create-react-app "project name" --use-npm
npx create-react-app.
On all cases the result was the error specified right in the top:
[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.......][...]
watching on the error a line came with a small clue:
"/Users/john/node_modules/babel-loader (version: "7.1.5") -> was a
version that creates conflict with above specified - version
"babel-loader#8.0.6"
for me the solution was: following this path through my folders and delete the node_modules folder then restart again the project.
C:\Users\user\node_modules\babel-loader
Delete node_modules from \user\node_modules don't delete from your project
if you are using backend (nodejs) check if you are using webpack in your backend
make sure your create-react-app webpack and backend webpack version same
In the /home/<username>/node_modules/babel-loader directory just change in the package.json file the version to "8.0.4" in your case.
Worked for me
I got the same error with babel-loader#8.1.0, I removed the reference from package.json and also the module from node_modules and installed "npm i babel-loader#8.1.0" but then introduced #jest error.
I removed the #jest module from node_modules then installed the required dependency version as I did for babel-loader to solve the issue.
For me the same issue was resolved by adding "resolutions": {
"babel-loader": "8.1.0" //the required version
} in my package.json file.
Removed node-modules, yarn.loack, package-lock.json
yarn start
It worked perfectly fine
I was having this issue and just added in
"babel-loader": "8.0.4",
to my package.json in the dependencies and it seemed to fix the issue

Cannot resolve module 'react-dom'

I've seen few posts related to this type of error. But couldn't resolve in mine.
My package.json:
"react": "~0.14.7",
"webpack": "^1.12.13",
"react-hot-loader": "^3.0.0-beta.6",
.
.
I'm getting following error on webpack:
ERROR in ./public/src/main.js
Module not found: Error: Cannot resolve module 'react-dom' in C:\Users\react-example\public\src
# ./public/src/main.js 19:16-36
But in the cmd line when I did
npm -v react-dom
I get 3.10.10. react-dom is there. But I wonder why it still gives this error.
When I installed react-dom through npm "npm install react-dom", and run webpack I get following errors:
ERROR in ./~/react-dom/lib/ReactDOMNullInputValuePropHook.js
Module not found: Error: Cannot resolve 'file' or 'directory' C:\Users\react-example/node_modules/react/lib/ReactComponentTreeHook in C:\Users\react-example\node_modules\react-dom\lib
# ./~/react-dom/lib/ReactDOMNullInputValuePropHook.js 13:29-72
ERROR in ./~/react-dom/lib/ReactDOMUnknownPropertyHook.js
Module not found: Error: Cannot resolve 'file' or 'directory' C:\Users\react-example/node_modules/react/lib/ReactComponentTreeHook in C:\Users\react-example\node_modules\react-dom\lib
# ./~/react-dom/lib/ReactDOMUnknownPropertyHook.js 15:29-72
ERROR in ./~/react-dom/lib/ReactDOMInvalidARIAHook.js
Module not found: Error: Cannot resolve 'file' or 'directory' C:\Users\react-example/node_modules/react/lib/ReactComponentTreeHook in C:\Users\react-example\node_modules\react-dom\lib
# ./~/react-dom/lib/ReactDOMInvalidARIAHook.js 14:29-72
ERROR in ./~/react-dom/lib/ReactDebugTool.js
Module not found: Error: Cannot resolve 'file' or 'directory' C:\Users\react-example/node_modules/react/lib/ReactComponentTreeHook in C:\Users\react-example\node_modules\react-dom\lib
# ./~/react-dom/lib/ReactDebugTool.js 16:29-72
Please help.
Issue is react-dom is not installed, when you hit npm -v react-dom, it gives you the version of npm not react-dom version, you can check that by using npm -v or npm -v react-dom both will give you the same result.
You are checking the package version incorrectly.
How to install react and react-dom properly?
Use this to install react and react-dom:
npm install react react-dom --save
After that, you can check your package.json file, if react and react-dom has been installed correctly, you will find an entry for that.
How to check install package version?
To check all the locally installed packages version:
npm list
For globally installed packages, use -g also:
npm list -g
To check the version of any specific package, specify the package name also:
npm list PackageName
For Example =>
npm list react
npm list react-router
After installation your package.json will look like this:
{
"name": "***",
"version": "1.0.0",
"main": "***",
"scripts": {
....
},
"repository": {
....
},
"keywords": [],
"author": "",
"dependencies": {
....
"react": "^15.4.2", //react
"react-dom": "^15.4.2", //react-dom
....
},
"devDependencies": {
....
}
}
Latest version of react-dom is : 15.4.2
Reference: https://www.npmjs.com/package/react-dom
In my case I had an alias in my webpack.config.common.js:
resolve: {
extensions: ['.js', '.jsx'],
alias: {
'react-dom': '#hot-loader/react-dom',
},
},
I just removed this line:
'react-dom': '#hot-loader/react-dom',
and it was fixed.
I used 'npm update' and that solved my problem.
In my case, it was an alias I had in my webpack.conf, which was looking for #hot-loader/react-dom.
For anybody reading this that wasn't able to figure it out. I had the same issue which I ended up resolving by installing the "react-router" package which is simply running the following command
npm i react-router-dom --save for a browser app.
npm i react-router-native for a native app.
You may need to update react and react-dom. Despite react-dom actually being installed, I was having this issue on ^15.5.4 and it went away with ^16.8.6:
$ # update the react and react-dom modules
$ yarn add react react-dom
Ensure that the two version match exactly in package.json:
"react": "^16.8.6",
"react-dom": "^16.8.6",
Delete yarn.lock, node_modules, and yarn again.
rm -Rf yarn.lock node_modules && yarn
You can also try to solve this issue by updating your react react-dom module, try
npm install react#latest react-dom#latest.
Try rm -rf node_modules && yarn or rm -rf node_modules && npm install if you use npm instead of yarn.
My particular issue for getting this error:
ERROR in ./src/index.js Module not found: Error: Can't resolve
'eact-dom' in
'C:\Users\Jose\Desktop\woz-u-React\React-Course\react-lesson-one\src'
# ./src/index.js 2:0-32 # multi
(webpack)-dev-server/client?http://localhost:8080 ./src/index.js
To fix this issue, I had to unzip the folder before installing.
The following command will resolve the problem.
npm install react react-dom --save
For those using Parcel, this can occur if you are targeting Node for a browser-based app.
There are 3 ways Parcel will infer this from your package.json:
Remove node as the target, or specify the --target as browser at the command line.
Also see:
https://v2.parceljs.org/getting-started/migration/
https://v2.parceljs.org/configuration/package-json/
Your app is pointing to the global version of react hence you need install it manually using global keyword. You can also compare your installed version of react-dom in package.json of your current project and globally installed react-dom version using command npm -v react-dom if both are different then manually install react dom using command:
sudo npm install -g react-dom#17.0.2

Resources