javascript - What to do if cross-env doesn't work?
淡淡烟草味
淡淡烟草味 2017-05-19 10:17:26
0
2
1009

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?

淡淡烟草味
淡淡烟草味

reply all(2)
淡淡烟草味

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

PHPzhong

NODE_ENV=dev这里不能有空格
"test": "cross-env NODE_ENV=dev&& node test.js"

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!