-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Not working in Windows 10: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined #149
Comments
same problem on mac os |
For me
macOS Catalina |
I have same error when I do not specify the executable file.
macOS Catalina, Node v14.5.0, [email protected] |
Yeah, same here. Looks like Catalina upgrade broke it. Will have to dump env-cmd from the project now :-( was great while it lasted macOS Catalina, Node v10.18.1, [email protected] |
so this might help but i just ran |
Did anyone find a fix for this? |
when you use env-cmd commands, you have to run env-cmd just before your app launch with your command. For windows (trying to run build:dev):
my error was this code : "scripts": {
"start": "react-scripts start",
"build": "set \"INLINE_RUNTIME_CHUNK=false\" && react-scripts build",
"build:dev": "env-cmd -f \".env.development\" && set \"INLINE_RUNTIME_CHUNK=false\" && react-scripts build",
}
solution : "scripts": {
"start": "react-scripts start",
"build": "set \"INLINE_RUNTIME_CHUNK=false\" && react-scripts build",
"build:dev": "set \"INLINE_RUNTIME_CHUNK=false\" && env-cmd -f \".env.development\" react-scripts build",
} (ignore on what does INLINE_RUNTIME_CHUNK that's just for the example) .env.development .env Now in your app you can do : const apiUrl = process.env.API_URL So if you call |
I'm having the same issue, I've tried running on both MacOS Catalina 10.15.7 and Ubuntu 20.04. I've tried multiple different versions, including all versions from 9.0.0-10.1.0, with the same result:
Has this been looked into? |
Yeah can't get this working on Big Sur at all 🤷♂️ |
Can confirm |
I just wanted to chime in that in my case it was due to my use of end of line comments when documenting the purpose of the variables: Bad: # MY_VAR=foo # development
MY_VAR=bar # production Good: ### development environment
# MY_VAR=foo
### production environment
MY_VAR=bar Guess I expected Maybe others have invisibles or something trailing the variable values or CRLF is not supported? (I'm on OSX 11.6) |
I just did that without '&&' on macOS Monterey and it works fine for me:
Also notice if you need to use '&&' try to use it before env-cmd command. |
I can confirm this does not work env-cmd -f .env.test I also tried full path instead of realtive still does not work |
without '&&' is working fine on Windows 11. ex:
|
@leqnam, @danielcn and @barder60 have the solution. env-cmd requires a command. You can't just run it on its own. If you do, you get the error in the title of this issue... "The "path" argument must be of type string. Received type undefined". The fact that so many people have tried to do this should be considered a feature request. Why should env-cmd need a command. Why can't it just load environment variables then exit? |
Issue: I''m not able to load any .env/.js file using
env-cmd
How to reproduce:
npm install -g env-cmd
.env
file and paste below content (taken from example repo)env-cmd
in that folderThis throws error which is mentioned below:
I tried to install it locally instead of globally but still same issue.
Also, If I rename
.env
to anything else like.env.dev
it denies its existence:I've also tried using async file i.e.
async-env.js
but still same issueFailed to find .env file
I've tried uninstalling installing again but doesn't work. I'm not sure if somebody tested this package in Windows or not but I can't make it work!
Platform: Windows 10
Teminal: Powershell core 6.2.3 (also tried with cmd but same error)
"env-cmd": "^10.1.0",
The text was updated successfully, but these errors were encountered: