npm start stopped working on Windows
Hi,
I've been using your package to create and run an application. However, this stopped working about 2 months ago and I'm not sure what caused it - I've just had the chance to delve into what is going on.
When I run npm start I've been getting the following:
[api] >> Command "git grep "^.env$" .gitignore" failed to run
[api] bash ./bin/dev_api.sh exited with code 1
--> Sending SIGTERM to other processes..
[www] Starting the development server...
The API fails to start, because git grep throws an error.
If I comment the following lines in deployNodeApp.js:373-376 out, npm start begins working again:
if (opts.generateDefaultEnv || opts.generateLocalPortsEnv) {
const envVars = await generateEnv(metaModules, opts.generateLocalPortsEnv ? format : null)
const envVarLines = []
for (const env in envVars) {
envVarLines.push(`${env}=${envVars[env]}`)
}
const content = envVarLines.join('\n') + '\n'
//checkForGitIgnored('.env')
//if (format === 'k8s') {
// checkForGitIgnored('secrets/')
//}
if (output === '-') process.stdout.write(content)
else await confirmWriteFile('.env', { content, output })
return null
}
Not sure what this code is supposed to do - but I assume it's necessary, so not sure how to resolve. I'm unsure if this is something I've changed in my project, or whether something else has caused this.
Any ideas?
Hello! Sorry for the long delay - I'll take a look at this. It seems to be that checkForGitIgnored is assuming the .gitignore file already exists (presumable touch .gitignore would make the code work)... It should create it if it does not exist!
The purpose of that code is to ensure .env and secrets/ are in the .gitignore file, in order to prevent accidental exposure of secrets to the git repo.
Thanks for the repo! I'll get this sorted shortly ❤️