TypeError: The "path" argument must be of type string. Received undefined

Dung Do Tien Jan 19 2021 536

I have a project with ReactJs. When I run the project with command npm start I got an exception TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined.

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at validateString (internal/validators.js:118:11)
    at Object.join (path.js:1039:7)
    at noopServiceWorkerMiddleware (/home/yunier/soft-dev/billmeapp/node_modules/react-dev-utils/noopServiceWorkerMiddleware.js:14:26)
    at Layer.handle [as handle_request] (/home/yunier/soft-dev/billmeapp/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/yunier/soft-dev/billmeapp/node_modules/express/lib/router/index.js:317:13)
    at /home/yunier/soft-dev/billmeapp/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/yunier/soft-dev/billmeapp/node_modules/express/lib/router/index.js:335:12)
    at next (/home/yunier/soft-dev/billmeapp/node_modules/express/lib/router/index.js:275:10)
    at launchEditorMiddleware (/home/yunier/soft-dev/billmeapp/node_modules/react-dev-utils/errorOverlayMiddleware.js:20:7)
    at Layer.handle [as handle_request] (/home/yunier/soft-dev/billmeapp/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/yunier/soft-dev/billmeapp/node_modules/express/lib/router/index.js:317:13)
    at /home/yunier/soft-dev/billmeapp/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/yunier/soft-dev/billmeapp/node_modules/express/lib/router/index.js:335:12)
    at next (/home/yunier/soft-dev/billmeapp/node_modules/express/lib/router/index.js:275:10)
    at handleWebpackInternalMiddleware (/home/yunier/soft-dev/billmeapp/node_modules/react-dev-utils/evalSourceMapMiddleware.js:42:7)
    at Layer.handle [as handle_request] (/home/yunier/soft-dev/billmeapp/node_modules/express/lib/router/layer.js:95:5)

I have no idea why this is happening, if anyone has experienced this I would be grateful.

Have 3 answer(s) found.
  • S

    Sandeep Kumar Jan 19 2021

    This issue occurs when react-scripts package error, You need only upgrade this package to resolve the issue.
    To check the latest version using the command npm info react-scripts version.

    1. Replace in your package.json "react-scripts": "^3.x.x" with "react-scripts": "^3.4.1" (or the latest available version)
    2. Delete your node_modules folder (this step is optional)
    3. Run npm install or yarn install
  • M

    Marry Christ Jan 19 2021

    I have got the same problem and I solved it by upgrading the react-scripts package from "react-scripts": "3.x.x" to "react-scripts": "^3.4.1" (or the latest available version).

    1. Delete node_modules folder
    2. Delete package-lock.json file
    3. Rewrite the package.json file from "react-scripts": "3.x.x" to "react-scripts": "^3.4.1"
    4. Install node packages again npm i

    Now, start the project npm start

  • M

    Manish Kumar Jan 19 2021

    To solve, update react-scripts to the latest version.

    yarn add react-scripts@latest 

    OR if you use npm

    npm install react-scripts@latest 
    
Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close