Jonas Hans
Jonas Hans

Reputation: 1

Task 'default' is not in your gulpfile after npm link gulp

I´m using gulp and defined my gulp task in the gulpfile.js Because i don´t want to install gulp every time i used the

npm install gulp -g
npm link gulp 

( the link command in my directory where i want to execute gulp ) after that the command "gulp" is available on my working directory, but it outputs:

Task 'default' is not in your gulpfile Blockquote

If I put a console log in the beginning of my gulpfile.js, I can see that he outputs the log and can find the gulpfile.js

Can anyone tell me where my problem is ?

I found this article but it did not helped me How to fix "Task is not in your gulpfile" error when using npm link?

Thanks so much

Upvotes: 0

Views: 1476

Answers (1)

Andras Szell
Andras Szell

Reputation: 527

There are two problems.

1. The misuse of npm link

What does npm link do?

it first creates a global link, and then links the global installation target into your project's node_modules folder.

https://docs.npmjs.com/cli/link

So if you want to install a package globally, don't use npm link, because it will create a global link pointing to your local node_modules folder.

2. No default task in your gulpfile

If you want to use the gulp command without parameters (so you want a default behaviour), then you should specify this task. For example:

// The default task (called when you run `gulp` from cli)
gulp.task('default', ['watch', 'scripts', 'images']);

https://github.com/gulpjs/gulp#sample-gulpfilejs

Upvotes: 3

Related Questions