Cannot create build: TypeError: Ajv is not a constructor
See original GitHub issueSteps To Reproduce
- Update to latest react-scripts (5.0.0)
- Do
npm run build
.
The current behavior
home/node/frontend/node_modules/mini-css-extract-plugin/node_modules/schema-utils/dist/validate.js:66
const ajv = new Ajv({
^
TypeError: Ajv is not a constructor
at Object.<anonymous> (/home/node/frontend/node_modules/mini-css-extract-plugin/node_modules/schema-utils/dist/validate.js:66:13)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:11[55](https://firelight.smokescreen.io/v4/frontend/-/jobs/95213#L55):10)
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 Object.<anonymous> (/home/node/frontend/node_modules/mini-css-extract-plugin/node_modules/schema-utils/dist/index.js:6:5)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:14
- Comments:12
Top Results From Across the Web
TypeError: Ajv is not a constructor - Stack Overflow
I have this class where I try to instantiate Ajv with the new keyword and I get this error: TypeError: Ajv is not...
Read more >TypeError: Ajv is not a constructor when I run npm run build ...
Same problem for me. I find if I delete node_modules and package-lock. json and then run npm install and npm run build ,...
Read more >TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >ajv-keywords - npm
This keyword allows a string to be modified during validation. This keyword applies only to strings. If the data is not a string,...
Read more >Fix the TypeError: MiniCssExtractPlugin is not a constructor
Solution 2. If for any reason you cannot update the package, you can use the following syntax in your webpack config file: const ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I got this fixed after uninstalling
npm-force-resolutions
and removing allpreinstall
related to that. And thenrm -rf node_modules
rm package-lock.json
npm install
Same issue here. Sometimes it works and sometimes it doesn’t.
Also happens on
npm run start
for me