Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
974 views
in Technique[技术] by (71.8m points)

npm - gulp command not found

Windows 10 pro x64

I ran the following commands

npm install --global gulp-cli
npm init

Then I changed directory to my project:

npm install --save-dev gulp

then tried to run gulp and got

-bash: gulp: command not found

my package.json file reads

{
 "name": "riad-kilani_v4-child",
  "version": "1.0.0",
  "description": "",
  "main": "gulpfile.js",
  "dependencies": {
    "gulp-cli": "^1.2.2"
  },
  "devDependencies": {
    "gulp": "^3.9.1",
    "gulp-sass": "^2.3.2"
  },
  "scripts": {
    "test": "echo "Error: no test specified" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

Any ideas on whats going on here?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I solved the problem creating an alias in ~/.bashrc like this:

alias gulp="node /home/deploy/app/node_modules/gulp/bin/gulp.js"

Just put the alias in the end of the .bashrc file, then run:

source ~/.bashrc

Test with:

gulp -v

You should see something like this:

[15:46:39] CLI version 3.9.1
[15:46:39] Local version 3.9.1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...