Reputation: 677
I have a Node/Angular project that won't run because of this error. I am getting the following error:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
More context for that error:
PS C:\Users\Vinay\retail-billpay-node> node server
internal/validators.js:124
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:124:11)
at resolve (path.js:139:9)
at pathArg (C:\Users\Vinay\retail-billpay-node\node_modules\mkdirp\lib\path-arg.js:15:10)
at mkdirp (C:\Users\Vinay\retail-billpay-node\node_modules\mkdirp\index.js:10:10)
at Object.<anonymous> (C:\Users\Vinay\retail-billpay-node\app\helpers\winston.js:26:3)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\Vinay\retail-billpay-node\app\services\LogService.js:9:17)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14) {
code: 'ERR_INVALID_ARG_TYPE'
}
And here is my package.json if it helps:
{
"name": "retail-billpay-node",
"version": "1.0.0",
"description": "start your node express app from this boilerplate code",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "siddhant-np",
"license": "ISC",
"dependencies": {
"async": "2.6.1",
"bluebird": "3.5.3",
"body-parser": "1.18.3",
"crypto": "1.0.1",
"csvtojson": "2.0.8",
"dotenv": "6.0.0",
"express": "4.16.3",
"extract-zip": "1.6.7",
"imap-simple": "4.3.0",
"ioredis": "4.6.2",
"kafka-node": "^5.0.0",
"lodash": "4.17.10",
"md5": "2.2.1",
"mkdirp": "0.5.1",
"moment": "2.22.2",
"moment-timezone": "0.5.21",
"mongoose": "5.2.9",
"nodemailer": "5.1.1",
"otp.js": "1.1.0",
"request": "2.87.0",
"util": "0.11.1",
"winston": "3.0.0",
"winston-daily-rotate-file": "3.2.1",
"xlsx": "0.14.1",
"xml-parse": "0.3.1",
"xml2js": "0.4.19",
"xmlbuilder": "10.0.0"
}
}
Upvotes: 1
Views: 11302
Reputation: 677
OK, I figured out the issue. I thought the error was telling me that path was undefined. When it fact it was saying the variables passed into path.join() were undefined. And that was because I forgot to add my .env file to the root so it could grab those variables.
Since it was an enterprise project so they don't keep .env file in the source code, I asked them and put it root.
Upvotes: 5