Say I have the following npm script:
"test": "node $FILE"
How would I pass an absolute path to it via cli?
Example:
FILE="pwd + filename" npm run test
which should result in:
node /Root/Subfolder/filename
I'm on MacOS using NodeJS 14.
For example, you have a script file eg ./scripts/test.js
.
The script config would be like this:
"test": "node ${FILE}"
And, the command to run it would be:
$ FILE="$(pwd)/scripts/test.js" npm run test
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.