I am trying to develop some testing for a legacy React application and I am getting the following error:
Error: Cannot find module ‘react-dom/test-utils’ Require stack:
- /Users/luiscortes/Projects/auth/client/test/test_helper.js
- /Users/luiscortes/Projects/auth/client/node_modules/mocha/bin/_mocha
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (/Users/luiscortes/Projects/auth/client/test/test_helper.js:4:1)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at loader (/Users/luiscortes/Projects/auth/client/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions. [as .js] (/Users/luiscortes/Projects/auth/client/node_modules/babel-register/lib/node.js:154:7)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at /Users/luiscortes/Projects/auth/client/node_modules/mocha/bin/_mocha:304:3
at Array.forEach ()
at Object. (/Users/luiscortes/Projects/auth/client/node_modules/mocha/bin/_mocha:303:10)
I have react-dom
installed. I have tried rm -rf node_modules
so many times.
This is my package.json file:
"scripts": {
"start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive ./test",
"test:watch": "npm run test -- --watch",
"build": "webpack -p --define process.env.NODE_ENV='"production"' --progress --colors"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.1.18",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
},
"dependencies": {
"axios": "^0.20.0-0",
"babel-preset-stage-1": "^6.1.18",
"chai": "^3.5.0",
"jquery": "^2.2.4",
"jsdom": "^9.3.0",
"lodash": "^3.10.1",
"mocha": "^2.3.4",
"react": "^0.14.3",
"react-dom": "^0.14.3",
"react-redux": "^4.0.0",
"react-router": "^2.0.1",
"redux": "^3.0.4",
"redux-form": "^4.2.2",
"redux-thunk": "^1.0.0"
}
}
Does anything look to be wrong with my version of react-dom
or any libraries that may be conflicting with it?