Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
softmarshmallow opened this issue May 16, 2021 · 7 comments · Fixed by #396

Comments

@softmarshmallow
Copy link

softmarshmallow commented May 16, 2021

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
@tmclean15
Copy link

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

@v4irajvimu
Copy link

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

did you?

@lawrensylvan
Copy link

I'm having the same issue

@saulelabra
Copy link

I'm having this issue as well

@allidoisace
Copy link

Also having this issue.

@allidoisace
Copy link

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.

@puerschel93
Copy link

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.

Thanks, i almost lost my mind because I used it with && like env-cmd -f .env.staging && react-scripts start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants