0

i really feel confused when i want to set some environment variable in one project's package.json scripts.i tried script like:

"start": "cp -f ./src... && NODE_ENV=dev wepy build --watch"

it works right and i get dev of process.env.NODE_ENV.

But why the following commands i firstly wrote can't set environment variable.and i get undefined of process.env.NODE_ENV:

"start": "cp -f ./src... && NODE_ENV=dev && wepy build --watch"

or

"start": "NODE_ENV=dev && cp -f ./src... && wepy build --watch"

what's wrong with my code?

luke-codewalker
  • 319
  • 3
  • 11
eder
  • 73
  • 2
  • 8
  • Could you elaborate what problem you are having? If the first way works, why not just use it? The use of `&&` also seems to depend on the OS you're using if you look at the comments of [this answer](https://stackoverflow.com/a/27090755/7595777). Maybe this helps to specify your problem? Also please check out https://stackoverflow.com/editing-help on how to format code blocks. – luke-codewalker Aug 18 '18 at 14:51
  • @luke-codewalker Thanks for your advice~I am a newbie for using stackoverflow. – eder Aug 29 '18 at 08:42

0 Answers0