question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received undefined

See original GitHub issue

The script from package.json

    ...
    "use:local": "env-cmd -f \".env.local\"",
    ...

image

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:open
  • Created 2 years ago
  • Reactions:10
  • Comments:7

github_iconTop GitHub Comments

6reactions
tmclean15commented, Jun 24, 2021

I am having the same issue, any update on this?

5reactions
allidoisacecommented, Feb 17, 2022

Okay guys, I have the answer.

env-cmd -f .env.staging react-scripts build

env-cmd -f <my env file path> <commands for env> We are assuming that env-cmd -f .env.staging works alone. However, you have to specify a command after it to which the environment applies.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found