gulpjs / gulp-cli

Command Line Interface for gulp.
MIT License
401 stars 106 forks source link

TypeError: Cannot read property 'apply' of undefined #192

Closed yuelin02 closed 5 years ago

yuelin02 commented 5 years ago

I still encounter this problem: /usr/local/lib/node_modules/gulp/bin/gulp.js:129 gulpInst.start.apply(gulpInst, toRun); ^ TypeError: Cannot read property 'apply' of undefined at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20 at process._tickCallback (internal/process/next_tick.js:61:11) at Function.Module.runMain (internal/modules/cjs/loader.js:757:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

The gulp version I'm using: CLI version 3.9.1 Local version 4.0.1

and I try to do npm i gulp-cli -g

but it still gives me the error when I run gulp

phated commented 5 years ago

If you've previously had gulp installed globally (as indicated by "CLI version 3.9.1"), you need to remove it before installing gulp-cli globally. See https://gulpjs.com/docs/en/getting-started/quick-start

yuelin02 commented 5 years ago

Thanks! I figured out. I tried this, but couldn't completely remove CLI 3.9.1, so I removed and reinstalled node with nvm.

chiky123ser commented 5 years ago

Thanks! I figured out. I tried this, but couldn't completely remove CLI 3.9.1, so I removed and reinstalled node with nvm.

Thanks, I saved the attempt to delete it and uninstall and reinstall the node version

tomfuertes commented 4 years ago

Hopefully helpful note as someone who just encountered this:

After running the global gulp-cli install, open a new terminal so it'll take effect.

npm uninstall -g gulp
npm uninstall -g gulp-cli

npm install -g gulp-cli
# close terminal and open new
som-cs commented 4 years ago

I did everything said here and everywhere else. IT DOESN'T WORK. uninstalled node. reinstalled it and installed gulp-cli in every twisted way possible. still the same error. even changed the node version from 12 to 14. so if anyone in this world can solve this.

BTW error comes in run-sequence

[21:20:54] Using gulpfile ~/Codes/Inventurist-Web-App/gulpfile.js
[21:20:54] Starting 'default'...
[21:20:54] Starting '<anonymous>'...
[21:20:54] '<anonymous>' errored after 3 ms
[21:20:54] TypeError: Cannot read property 'apply' of undefined
    at runNextSet (/home/som/Codes/Inventurist-Web-App/node_modules/run-sequence/index.js:124:15)
    at runSequence (/home/som/Codes/Inventurist-Web-App/node_modules/run-sequence/index.js:136:2)
    at /home/som/Codes/Inventurist-Web-App/gulpfile.js:295:3
    at bound (domain.js:427:14)
    at runBound (domain.js:440:12)
    at asyncRunner (/home/som/Codes/Inventurist-Web-App/node_modules/async-done/index.js:55:18)
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
phated commented 4 years ago

run-sequence doesn't work with gulp 4.

phated commented 4 years ago

@mcastets No, don't do that. (Removing your incorrect suggestion)