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

npm install not working on Windows - Unable to set NODE_ENV Environment Variable #192

Open
coding-jj opened this issue Dec 23, 2020 · 1 comment

Comments

@coding-jj
Copy link

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-graphql directory
  • 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

@antonstalheim
Copy link

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! :)

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

No branches or pull requests

2 participants