84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
I only want to install gulp locally on mac, how to run the gulp command
学习是最好的投资!
gulpscriptto `scripts` ofpackage.json
script
"scripts": { "gulp": "gulp" }
npm run gulp -- --version
The disadvantage of this method is that it can only be run under the current project
Find the gulp installation directory , and then add the directory /node_modules/.bin to the environment variable
I don’t quite understand your question. I only want to install it locally. Does it mean that gulp is not included when deployed to the server?
Using npm run can solve this problem.Or when executing gulp in the current directory, writing ./gulp can also solve the problem.
I don’t understand the reason for not installing gulp globally.
Run it directly under your project
./node_modules/.bin/gulp
It is recommended to install it globally or use npm script as other answerers said
// package.json { "devDependencies": { "gulp": "^3.9.1" }, "scripts": { "start": "gulp" } }
Run
npm start
You cannot use the gulp command directly in the terminal without sudo to install gulp globally.
Alternatively, you can write"gulp": "gulp xxx"in the npm script of package.json to usenpm run gulpto run the gulp installed in the project
"gulp": "gulp xxx"
npm run gulp
npm run ‘xx’ way. Don't run gulp directly.
Don’t want to install it globally, but want to use gulp in the command line?
Try npm link ?
https://docs.npmjs.com/cli/linkhttp://javascript.ruanyifeng....https://github.com/atian25/bl...
npm script
Addgulp
script
to `scripts` ofpackage.json
The disadvantage of this method is that it can only be run under the current project
Environment variables
Find the gulp installation directory, and then add the directory /node_modules/.bin to the environment variable
I don’t quite understand your question. I only want to install it locally. Does it mean that gulp is not included when deployed to the server?
Using npm run can solve this problem.
Or when executing gulp in the current directory, writing ./gulp can also solve the problem.
I don’t understand the reason for not installing gulp globally.
Run it directly under your project
It is recommended to install it globally or use npm script as other answerers said
Run
You cannot use the gulp command directly in the terminal without sudo to install gulp globally.
Alternatively, you can write
"gulp": "gulp xxx"
in the npm script of package.json to usenpm run gulp
to run the gulp installed in the projectnpm run ‘xx’ way. Don't run gulp directly.
Don’t want to install it globally, but want to use gulp in the command line?
Try npm link ?
https://docs.npmjs.com/cli/link
http://javascript.ruanyifeng....
https://github.com/atian25/bl...