swapi-graphql
swapi-graphql copied to clipboard
npm install not working on Windows - Unable to set NODE_ENV Environment Variable
Description
npm install will not work on MS Windows 10. The system ins not able to set Environment Variable NODE_ENV
Please make swapi-graphql work with Windows 10.
Steps to Reproduce
- Git clone Project to Windows
- Open Windows Powershell in
swapi-graphqldirectory - Run
npm install
Error will occur:
> swapi-graphql@ build:lambda D:\z_git_jj\_graphql\swapi-graphql
> NODE_ENV=development netlify-lambda build handler
Der Befehl "NODE_ENV" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
Translation: The Command "NODE_ENV" is either misspelled or could not be found.
Solution
npm install cross-env- Edit Line 40 in
package.json"build:lambda"- Add cross-env before setting variable - Run
npm install
package.json:
"build:lambda": "cross-env NODE_ENV=development netlify-lambda build handler",
Further Readings
Stackoverflow: How to set environment variables from within package.json
I ran into the same problem, but just changed the same line to SET NODE_ENV instead of installing an additional package. Works like a charm! :)