Within my project’s package.json
I have:
json
"dependencies": {
"gulp": "git+https://github.com/gulpjs/gulp.git#4.0"
}
If I globally install stable gulp
(3.X) and run gulp
it fails (known issue, ok). But if I globally install gulp-cli
it also fails:
bash
$ gulp
[15:59:34] Using gulpfile ~/src/XXX/gulpfile.js
/Users/xxxxxx/.npm-packages/lib/node_modules/gulp-cli/index.js:133
gulpInst.start.apply(gulpInst, toRun);
^
TypeError: Cannot call method 'apply' of undefined
at /Users/xxxxxx/.npm-packages/lib/node_modules/gulp-cli/index.js:133:20
at process._tickDomainCallback (node.js:463:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:906:3
I fail to understand the purpose of gulp-cli
if it fails in this scenario. Do I miss something?
npm install -g "gulpjs/gulp-cli#4.0"
?If anyone’s testing gulp 4 in a project and doesn’t want to install gulp globally, you can reference the local gulp 4.0 with
$(npm bin)/gulp
.I’m new to gulp.
I’m getting the similar error when i run gulp command
Even I tried running npm install -g “#4.0″ as @heikki said
My present version is
CLI version 3.9.1
Local version 4.0.0-alpha.2
@xzegga yep I resolved it , it’s working.
Bring back your CLI version to 1.2.2 it will support gulp 4, and will solve your problem.
to install gulp-cli 1.2.2 run
sudo npm install gulp-cli@1.2.2 -g
and to install gulp local run
npm install 'gulpjs/gulp.git#4.0' --save-dev
when you run
gulp -v
commandyou should get
[11:38:36] CLI version 1.2.2
[11:38:36] Local version 4.0.0-alpha.2
I confirm that the solution proposed by @rajathms works !
I did :
sudo npm install gulp-cli@1.2.2 -g