“NODE_ENV” is not recognized as an internal or external command, operable command or batch file

后端 未结 16 1579
清歌不尽
清歌不尽 2020-11-29 15:33

I\'m trying to setup an environment for a Node.js app. but I\'m getting this error every time.

\"NODE_ENV\" is not recognized as an internal or extern

16条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-29 16:19

    If anyone else came here like me trying to find a solution for the error:

    'env' is not recognized as an internal or external command
    

    The reason I got this is that I was migrating an angular solution from a mac development machine over to a windows 10 desktop. This is how I resolved it.

    1. run npm install --save-dev cross-env

    2. go into my package.json file and change all the script references from env to cross-env

    Then my commands like: npm run start:some_random_environment_var now run fine on Windows 10.

提交回复
热议问题