Start the React project and report the following error:
[ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:120:11)......
There are two possible reasons for this error. The solution is as follows:
The React – Scripts version may be too low. The solution is as follows:
1. In package.json, replace "react-scripts": "^3.3.0" with
"react-scripts": "^3.4.0"
2. Delete the node_modules folder
3. Run cnpm i for a second
2. Modify the config/webpackDevServer. Config. Js file, as follows:
Look at the config/webpackDevServer. Config. Js files have the following code:
app.use(noopServiceWorkerMiddleware());
Modified into
app.use(noopServiceWorkerMiddleware('/'));
Done!
Read More:
- TypeScript error TS2345: Argument of type ‘String ‘is not assignable to parameter of type ‘string’
- [Solved] Syntax Error: Error: PostCSS received undefined instead of CSS string
- Syntax Error: Error: PostCSS received undefined instead of CSS string
- [Vue warn]: Invalid prop: type check failed for prop “index“. Expected String, got Undefined
- [Solved] Invalid prop: type check failed for prop “index“. Expected String, got Undefined
- request.js?b775:101 Uncaught (in promise) Error: Failed to convert value of type ‘java.lang.String’ to required type ‘java.lang.Long’;
- [Solved] Vue3 Error: Cannot use ‘in‘ operator to search for ‘path‘ in undefined
- After installing NPM, NRM LS reports an error throw new err_INVALID_ARG_TYPE(name, ‘string‘, value)
- Element-plus Warning: ElementPlusError: [Util] binding value must be a string or number.
- [Solved] npm Error: Class extends value undefined is not a constructor or null
- React Error: history is undefined [How to Solve]
- node.js yarn Error: SyntaxError: Unexpected string [How to Solve]
- [Solved] Syntax Error: TypeError: Cannot read property ‘parseComponent‘ of undefined
- Cannot read property ‘isFile‘ of undefined [How to Solve]
- [Solved] Install The Latest Version of Jest Error: TypeError: Cannot read property ‘instrument‘ of undefined
- [Solved] Vue Error: Syntax Error: TypeError: Cannot set properties of undefined (setting ‘XXX’)
- JS to find the last character of the string and remove it
- [Solved] JS Error: cannot set property xxx of undefined
- [Solved] Cannot read property ‘setCheckedKeys‘ of undefined“
- [Vue warn]: Error in callback for watcher “fileList”: “TypeError: Cannot create property ‘uid’ on string