. Advertisement .
..3..
. Advertisement .
..4..
While we are trying to create a new project, we face the following TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received type undefined raised when starting react app. If you’re looking for solutions, you’ll find them in our upcoming article. Let’s start solving this issue!
When Does ”TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received type undefined raised when starting react app Error” Happen?
We are working on our new project, and whenever we run the start command, we receive the following error. TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received type undefined.
What Can We Do To Solve ”TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received type undefined raised when starting react app”
Solution 1: Upgrade the react-scripts package
For the first solution, upgrade the react-scripts package.
- In your package, try replacing package.json
"react-scripts": "^3.x.x"
with"react-scripts": "^3.4.1"
. - Remove your node modules directory.
- Install
npm
oryarn
to get started
Some developers confirmed that using the npm audit fix caused this problem, so you should avoid it.
Solution 2: Upgrade the package.json folder to the latest version
Here are lines of command to upgrade the package.json folder to the latest version.
- Remove the node modules folder.
- Remove the
package-lock.json
file. - Change the
react-scripts
in thepackage.json
folder - Install node modules once more
- Start the project now with
npm
start.
Solution 3: Replace “react-scripts”: “3.x.x” with “react-scripts”: “^3.4.1”
Excepting the above mentioned solutions, there is another solution for you to solve the error ”TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received type undefined raised when starting react app”. It is replacing “react-scripts”: “3.x.x” with “react-scripts”: “^3.4.1”. To do that, you need to exclude node_modules\
folder and package-lock.json
file first. Then from "react-scripts": "3.x.x"
to "react-scripts": "^3.4.1"
,let’s write write the package.json
file again. After that, you need to set up node packages once more time npm i
. And finally, you can start the project npm start
.
Conclusion
You may consider using our solutions for solving TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received type undefined raised when starting react app, or you may apply your most suitable answer. Please address any concerns in the comments section to let us help you, and we will respond to them all. Thank you!
Read more
→ TypeError: ‘Series’ Objects Are Mutable, Thus They Cannot Be Hashed
Leave a comment