TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received undefined
See original GitHub issueThe script from package.json
...
"use:local": "env-cmd -f \".env.local\"",
...

yarn use:local
yarn run v1.22.10
$ env-cmd -f "./.env.local"
TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received undefined
at validateString (internal/validators.js:124:11)
at normalizeSpawnArguments (child_process.js:411:3)
at Object.spawn (child_process.js:551:13)
at Object.spawn (/Users/accounts-services/node_modules/cross-spawn/index.js:12:24)
at Object.EnvCmd (/Users/accounts-services/node_modules/env-cmd/dist/env-cmd.js:59:26)
at async Object.CLI (/Users/accounts-services/node_modules/env-cmd/dist/env-cmd.js:19:16) {
code: 'ERR_INVALID_ARG_TYPE'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
the .env.local from same directory
DATABASE_URL="postgresql://user:password@localhost:5432/main?schema=public"
# AWS CREDENTIALS
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=......
AWS_REGION=us-west-1
PASSWORD_KEY=internal-dev-password-key
JWT_SECRET_KEY=internal-dev-jwt-secret-key
# SLACK BOT HOOK KEYS
SLACK_BOT_TOKEN=your-testing-bot-token
SLACK_AQUISITION_NOTIFICATIONS_CHANNEL_ID=C022DJ74CJD
#GITHUB CLIENT VALUES
GITHUB_CLIENT_SECRET=add-your-test-github-client-secret
GITHUB_CLIENT_ID=12345678;
# NODE_ENV
NODE_ENV=development
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:7
Top Results From Across the Web
The "path" argument must be of type string. Received ...
'TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined' · 2. Try deleting and re-installing node ...
Read more >[Bug]: The "file" argument must be of type string. Received ...
Self-service I'd be willing to implement a fix Describe the bug In my package.json I have cinfigurated a "script" like this (most data ......
Read more >[Fix] TypeError [ERR_INVALID_ARG_TYPE]: The “path ...
Have you run into the error “TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received undefined”? In this story I'll go...
Read more >typeerror [err_invalid_arg_type]: the "data" argument must ...
To resolve the issue of cannot write undefined to file as Buffer or String instance was extepected we have to take a look...
Read more >The "url" argument must be of type string. Received ...
js file, or check the package.json file all npms are updated to the latest version. If you are new to node js and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I am having the same issue, any update on this?
Okay guys, I have the answer.
env-cmd -f <my env file path> <commands for env>We are assuming thatenv-cmd -f .env.stagingworks alone. However, you have to specify a command after it to which the environment applies.