简体   繁体   中英

babel-node param prefixed with “--” isn't passing

I have a npm start script "start": "babel-node index.js" If I want to pass arguments to it it is working if I not prefix the arguments with -- .

I want to pass something like npm start --delete to delete the content of a database.

I try to get the arguments via process.argv .

npm start delete passes the argument but npm start --delte isn't.

Is there anything I have to do to get this working or it is even possible? Thanks in advance.

To fix this I have to do: npm start -- --delete then the --delete is passed into my script. For this specific problem it isn't possible any other way at the moment when not touching the current toolchain.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM