例如,要启动本地安装的gulp,我必须从我的项目内部运行以下命令:
node_modules/gulp/bin/gulp.js
为了能够按名称启动npm packages ,我想将 node_modules 包含在项目的根目录中。这可能吗?
P.S
我知道如何在全局安装npm软件包,但我正在努力避免这样做。
答案 0 :(得分:1)
I hope I understand you correctly: You are trying to execute programs like gulp
from your local install.
You can set up a npm script like so in your package.json
:
package.json
...
"scripts": {
"build": "./node_modules/.bin/gulp"
}
...
Then, you can run gulp via npm run build
from your command line. (Or optionally you can type ./node_modules/.bin/gulp
)