Open xgqfrms opened 11 months ago
#!/usr/bin/env bash
# node -v
node --env-file=config.env index.js
{
"name": "nodejs_playground",
"version": "0.0.1",
"description": "Node.js v20.6.x+",
"main": "index.js",
"type": "module",
"scripts": {
"start": "$npm_package_bin_npcli_old",
"test": "echo \"Error: no test specified\" && exit 1"
},
"bin": {
"npcli_old": "node --env-file=config.env index.js",
"npcli_sh": "./npcli.sh",
"npcli": "./npcli"
},
"keywords": [
"Node.js"
],
"author": "xgqfrms",
"license": "MIT"
}
npx
eric@rpi4b:~/Desktop/node-playground $ ane PORT=8888
-bash: ane:未找到命令
eric@rpi4b:~/Desktop/node-playground $ npm-do ane PORT=8888
-bash: npm-do:未找到命令
eric@rpi4b:~/Desktop/node-playground $ npx ane PORT=8888
🚀 your node.js version = 18
🎮 creating...
🎉 finished!
eric@rpi4b:~/Desktop/node-playground $ ./node_modules/app-node-env/ane PORT=8888
🚀 your node.js version = 18
🎮 creating...
🎉 finished!
eric@rpi4b:~/Desktop/node-playground $
npx
https://2ality.com/2016/01/locally-installed-npm-executables.html
how to use npm run bin script form the local package.json file
等价于
refs
https://github.com/npm/npm/issues/7137#issuecomment-361069180
https://www.cnblogs.com/xgqfrms/p/17693872.html#5216528