The scripts statements in package.json are as follows
"test": "cross-env NODE_ENV=dev && node test.js"
test.js has only one sentence console.log(process.env.NODE_ENV)
But the result shows undefined
Why?
淡淡烟草味2017-05-19 10:19:26
Ask and answer your own question, the reason is that there cannot be anything in the middle&&
,&&
This will divide the two environments before and after, resulting in the environment of the latter statement not having NODE_ENV