10

I am trying to run a react application in my local machine , I get this error when I ran npm run start:

> node scripts/start.js

internal/validators.js:125
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at Object.resolve (path.js:161:7)
    at resolveApp (D:\Projects\react-app\react-site-master\config\paths.js:10:41)
    at Object.<anonymous> (D:\Projects\react-app\react-site-master\config\paths.js:73:13)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! glc2@0.1.5 start: `node scripts/start.js`
npm ERR! Exit status 1

I have tried to do the following but it is the same:

  1. npm cache clean --force
  2. delete node_modules with package-lock.json
  3. npm install

Thanks in advance,

L. Dabbeet
  • 290
  • 1
  • 3
  • 14
  • Does this answer your question? ['TypeError \[ERR\_INVALID\_ARG\_TYPE\]: The "path" argument must be of type string. Received type undefined'](https://stackoverflow.com/questions/60234640/typeerror-err-invalid-arg-type-the-path-argument-must-be-of-type-string-r) – Henke Oct 12 '22 at 12:27

2 Answers2

10

Make sure you have the correct version of react-scripts. Try react-scripts 3.4.0.

If you have a previous version of react-scripts, you can follow the directions on how to migrate from your version to 3.4.0: https://github.com/facebook/create-react-app/releases

Another option is to update your package.json file to use "react-scripts": "3.4.0". Make sure you delete your node_modules folder and package-lock.json before running npm install after updating the package.json

1

Changing my version of react-scripts from 3.3.1 to 3.4.0 worked for me. Use the command

npm install --save --save-exact react-scripts@3.4.0

If you have react-scripts@3.4.0 already you can upgrade it to v3.4.1 with the same command. This automatically updates the version listed on your package.json file.

deiza
  • 11
  • 1