Madeline Ries
Madeline Ries

Reputation: 629

node command to set env variable works on linux and mac but not on windows

After I git clone a project I can't run npm run build on Windows, although it's working on Mac and Linux :

"build": "API=https://dev-api.myexample.com/v1.0 babel-node build.js",

I got this error :

'API' is not recognized as an internal or external command, operable program or batch file.

Upvotes: 1

Views: 154

Answers (1)

laruiss
laruiss

Reputation: 3816

You should use cross-env (add it first to your dependencies with npm i cross-env see https://www.npmjs.com/package/cross-env)

"build": "cross-env API=https://dev-api.myexample.com/v1.0 babel-node build.js",

Upvotes: 3

Related Questions