Tag Archives: ERR_INVALID_ARG_TYPE

After installing NPM, NRM LS reports an error throw new err_INVALID_ARG_TYPE(name, ‘string‘, value)

Error screenshot:

error screenshots are seen in the cli. Js file line 17 error,

According to the path to find the file:
open files found an error line 17, note down the original 17 rows instead as shown in figure:

//const NRMRC = path.join(process.env.HOME, '.nrmrc');(Note these codes)
const NRMRC = path.join(process.env[(process.platform == 'win32') ?'USERPROFILE' : 'HOME'], '.nrmrc');

After executing CMD, enter NRM ls problem solved

[ERR_INVALID_ARG_TYPE]: The “path“ argument must be of type string. Received undefined error

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!