title: NodeJS - TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
body: <p>I have a Node/React project in my Webstorm that won't run because of this error.  I had to reinstall Windows and start fresh with my development.  I got the code back into the IDE, but when I start up the Node server, I am getting the following error: <code>TypeError [ERR_INVALID_ARG_TYPE]: The &quot;path&quot; argument must be of type string. Received undefined</code></p>
  <p>More context for that error:</p>
  <pre><code>[nodemon] starting `babel-node src/node-server/index.js`
  internal/validators.js:122
      throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
      ^
  
  TypeError [ERR_INVALID_ARG_TYPE]: The &quot;path&quot; argument must be of type string. Received undefined
      at validateString (internal/validators.js:122:11)
      at Object.join (path.js:375:7)
      at Object.&lt;anonymous&gt; (C:\Projects\Production-Orchestrator\src\node-server\/index.js:17:15)
  </code></pre>
  <p>I went to index.js and here is lines 1-17:</p>
  <pre><code>// npm run server
  import dotenv from 'dotenv';
  import express from 'express';
  import path from 'path';
  import sql from 'mssql';
  import cors from 'cors';
  import http from 'http';
  import { setupWebSocket } from './ws/setupWebSocket.js';
  
  const useWebSockets = true;
  
  dotenv.config();
  
  const dbConfig = {
      user: process.env.DB_USER,
      password: process.env.DB_PASS,
      server: path.join(process.env.DB_SERVER, process.env.DB_HOST),
  </code></pre>
  <p>I am running <code>npm run server</code> to start up my node server.</p>
  <p>And here is my package.json if it helps:</p>
  <pre><code>{
    &quot;name&quot;: &quot;my-app&quot;,
    &quot;version&quot;: &quot;0.1.0&quot;,
    &quot;private&quot;: true,
    &quot;description&quot;: &quot;my app&quot;,
    &quot;homepage&quot;: &quot;.&quot;,
    &quot;repository&quot;: {
      &quot;type&quot;: &quot;git&quot;,
      &quot;url&quot;: &quot;git+https://github.com/xxxxxxx&quot;
    },
    &quot;license&quot;: &quot;UNLICENSED&quot;,
    &quot;scripts&quot;: {
      &quot;buildp&quot;: &quot;env-cmd -f .env.production react-scripts build&quot;,
      &quot;buildt&quot;: &quot;env-cmd -f .env.test react-scripts build&quot;,
      &quot;buildw&quot;: &quot;webpack --config ./webpack.config.js --mode production&quot;,
      &quot;eject&quot;: &quot;react-scripts eject&quot;,
      &quot;eslint-check&quot;: &quot;eslint --print-config src/components/search/Search.js | eslint-config-prettier-check&quot;,
      &quot;server&quot;: &quot;nodemon --exec babel-node src/node-server/index.js&quot;,
      &quot;start&quot;: &quot;SET REACT_APP_WS_PORT=3001 &amp; react-scripts start&quot;,
      &quot;startw&quot;: &quot;webpack-dev-server --config ./webpack.config.js --mode development --open&quot;,
      &quot;stylelint&quot;: &quot;stylelint **/*.scss&quot;,
      &quot;test&quot;: &quot;react-scripts test&quot;,
      &quot;ws&quot;: &quot;node --experimental-modules src/node-server/websocket.js&quot;,
      &quot;ws2&quot;: &quot;nodemon --exec babel-node src/node-server/websocket.js&quot;
    },
    &quot;browserslist&quot;: {
      &quot;production&quot;: [
        &quot;&gt;0.2%&quot;,
        &quot;not dead&quot;,
        &quot;not op_mini all&quot;
      ],
      &quot;development&quot;: [
        &quot;last 1 chrome version&quot;,
        &quot;last 1 firefox version&quot;,
        &quot;last 1 safari version&quot;
      ]
    },
    &quot;dependencies&quot;: {
      &quot;@babel/preset-react&quot;: &quot;^7.8.0&quot;,
      &quot;@emotion/core&quot;: &quot;latest&quot;,
      &quot;@fortawesome/fontawesome&quot;: &quot;^1.1.8&quot;,
      &quot;@fortawesome/fontawesome-svg-core&quot;: &quot;^1.2.27&quot;,
      &quot;@fortawesome/free-regular-svg-icons&quot;: &quot;^5.12.1&quot;,
      &quot;@fortawesome/free-solid-svg-icons&quot;: &quot;^5.12.1&quot;,
      &quot;@fortawesome/react-fontawesome&quot;: &quot;^0.1.8&quot;,
      &quot;@popperjs/core&quot;: &quot;^2.0.6&quot;,
      &quot;@react-pdf/renderer&quot;: &quot;^1.6.8&quot;,
      &quot;@types/react&quot;: &quot;^16.9.19&quot;,
      &quot;animate.css&quot;: &quot;^3.7.2&quot;,
      &quot;axios&quot;: &quot;^0.19.2&quot;,
      &quot;babel-loader&quot;: &quot;^8.0.6&quot;,
      &quot;bootstrap&quot;: &quot;^4.4.1&quot;,
      &quot;bufferutil&quot;: &quot;^4.0.1&quot;,
      &quot;cors&quot;: &quot;^2.8.5&quot;,
      &quot;dayjs&quot;: &quot;^1.8.20&quot;,
      &quot;device-detector-js&quot;: &quot;^2.2.1&quot;,
      &quot;dotenv&quot;: &quot;^8.2.0&quot;,
      &quot;express&quot;: &quot;^4.17.1&quot;,
      &quot;express-ws&quot;: &quot;^4.0.0&quot;,
      &quot;file-saver&quot;: &quot;^2.0.2&quot;,
      &quot;javascript-time-ago&quot;: &quot;latest&quot;,
      &quot;jquery&quot;: &quot;^3.4.1&quot;,
      &quot;jsbarcode&quot;: &quot;^3.11.0&quot;,
      &quot;mssql&quot;: &quot;^6.1.0&quot;,
      &quot;popper.js&quot;: &quot;^1.16.1&quot;,
      &quot;print-js&quot;: &quot;^1.0.63&quot;,
      &quot;prop-types&quot;: &quot;^15.7.2&quot;,
      &quot;react&quot;: &quot;^16.12.0&quot;,
      &quot;react-animations&quot;: &quot;^1.0.0&quot;,
      &quot;react-beautiful-dnd&quot;: &quot;^12.2.0&quot;,
      &quot;react-beforeunload&quot;: &quot;^2.2.1&quot;,
      &quot;react-collapse&quot;: &quot;^5.0.1&quot;,
      &quot;react-confirm-alert&quot;: &quot;^2.6.1&quot;,
      &quot;react-custom-scrollbars&quot;: &quot;^4.2.1&quot;,
      &quot;react-detect-offline&quot;: &quot;^2.4.0&quot;,
      &quot;react-dnd&quot;: &quot;^10.0.2&quot;,
      &quot;react-dnd-html5-backend&quot;: &quot;^10.0.2&quot;,
      &quot;react-dom&quot;: &quot;^16.12.0&quot;,
      &quot;react-modal&quot;: &quot;^3.11.1&quot;,
      &quot;react-notifications-component&quot;: &quot;^2.3.0&quot;,
      &quot;react-popup&quot;: &quot;^0.10.0&quot;,
      &quot;react-radio-group&quot;: &quot;^3.0.3&quot;,
      &quot;react-router-dom&quot;: &quot;^5.1.2&quot;,
      &quot;react-scripts&quot;: &quot;^3.4.3&quot;,
      &quot;react-select&quot;: &quot;^3.0.8&quot;,
      &quot;react-spinners&quot;: &quot;^0.8.0&quot;,
      &quot;react-spring&quot;: &quot;^8.0.27&quot;,
      &quot;react-time-ago&quot;: &quot;^5.0.7&quot;,
      &quot;react-transition-group&quot;: &quot;^4.3.0&quot;,
      &quot;sort-package-json&quot;: &quot;^1.40.0&quot;,
      &quot;styled-components&quot;: &quot;^4.4.1&quot;,
      &quot;typescript&quot;: &quot;^3.7.5&quot;,
      &quot;utf-8-validate&quot;: &quot;^5.0.2&quot;,
      &quot;ws&quot;: &quot;^7.2.5&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@babel/cli&quot;: &quot;^7.8.4&quot;,
      &quot;@babel/core&quot;: &quot;^7.8.4&quot;,
      &quot;@babel/node&quot;: &quot;^7.10.5&quot;,
      &quot;@babel/preset-env&quot;: &quot;^7.8.4&quot;,
      &quot;@welldone-software/why-did-you-render&quot;: &quot;^4.2.5&quot;,
      &quot;css-loader&quot;: &quot;^3.4.2&quot;,
      &quot;dotenv-cli&quot;: &quot;^3.2.0&quot;,
      &quot;env-cmd&quot;: &quot;^10.1.0&quot;,
      &quot;eslint&quot;: &quot;^6.8.0&quot;,
      &quot;eslint-config-prettier&quot;: &quot;^6.10.0&quot;,
      &quot;eslint-loader&quot;: &quot;^3.0.3&quot;,
      &quot;eslint-plugin-babel&quot;: &quot;^5.3.0&quot;,
      &quot;eslint-plugin-prettier&quot;: &quot;^3.1.2&quot;,
      &quot;file-loader&quot;: &quot;^5.0.2&quot;,
      &quot;html-loader&quot;: &quot;^0.5.5&quot;,
      &quot;html-webpack-plugin&quot;: &quot;^3.2.0&quot;,
      &quot;node-sass&quot;: &quot;^4.13.1&quot;,
      &quot;nodemon&quot;: &quot;^2.0.4&quot;,
      &quot;prettier&quot;: &quot;^1.19.1&quot;,
      &quot;react-hot-loader&quot;: &quot;^4.12.19&quot;,
      &quot;sass-loader&quot;: &quot;^8.0.2&quot;,
      &quot;stylelint&quot;: &quot;^13.2.0&quot;,
      &quot;stylelint-config-rational-order&quot;: &quot;^0.1.2&quot;,
      &quot;stylelint-config-standard&quot;: &quot;^19.0.0&quot;,
      &quot;stylelint-order&quot;: &quot;^4.0.0&quot;,
      &quot;stylelint-scss&quot;: &quot;^3.14.2&quot;,
      &quot;url-loader&quot;: &quot;^3.0.0&quot;,
      &quot;webpack&quot;: &quot;^4.44.1&quot;,
      &quot;webpack-cli&quot;: &quot;^3.3.11&quot;
    },
    &quot;proxy&quot;: &quot;http://localhost:3000&quot;
  }
  </code></pre>