No gulpfile found
Asked Answered
K

11

10

I am new in laravel. I am trying the command nmp install. it does not work. Then as shown in their official documentation, I tried

npm install --global gulp-cli

but I was getting access denied error. So I gave

sudo npm install --global gulp-cli

It seemed to give me some correct result. then I gave

npm install --no-bin-links

but it says that,

"npm WARN [email protected] No description npm WARN [email protected] No repository field." I tried

npm install -d

though the result ended with "ok" (after running the command the first line said "it worked if it ends with ok"), it still contains ""npm WARN [email protected] No description npm WARN [email protected] No repository field." And when I gave the command

gulp

the answer was no gulpfile found. In my project there is a gulpfile.js file (I am not sure about which gulpfile it is talking :\ )

what to do? My node version is V5.12.0

Knapp answered 13/8, 2016 at 21:19 Comment(5)
did you ran "gulp" from project folder?Incontinent
can you post the directory path on your terminal when you run "gulp" commandIncontinent
vagrant@homestead:~/Code/laravel$ gulpKnapp
What version of Laravel you are running?Adjourn
If you are explicitly using something like gulp --gulpfile custom_gulpfile.js and you get this error - check the file path, if the path is wrong you still get the same error :)Suspensory
I
21

In my case, in order to solve the error, 'no gulpfile found' I wrongly called the configuration file as gulp.js instead of gulpfile.js.

So just make sure you didn't misspell the file.

Another possible reason why you might get this error is when you are running the gulp command in the wrong directory. Make sure the gulpfile.js is not inside another folder but within the project folder.

Incunabulum answered 21/11, 2017 at 6:56 Comment(0)
L
12

This error means that gulp doesn't find gulpfile.js to follow the instructions. To solve this error we need to add gulpfile.js to our directory root by running the command.

Create gulpfile.js and then add

var gulp = require('gulp');
gulp.task('default', function () { 
    console.log('Hello Gulp!') 
});
Legislatorial answered 1/5, 2017 at 7:4 Comment(1)
Is it possible to use npm run watch instead of gulp?Moshemoshell
B
1

I also had this issue. I created the gulpfile.js file through explorer so it was incorrectly named gulpfile.js.txt which prevented the gulp command finding it. This only became obvious when I opened the project in a text editor and I saw the extension.

Baillieu answered 7/4, 2018 at 21:26 Comment(1)
thank man. I spelled it fulpfile.js and wondering why the heck it is giving me that error :DSlot
H
1

I encountered same problem in Laravel 6. I solved it by steps:

npm init
npm install --save-dev gulp
npx mkdirp yourProjectName
npm install --save-dev gulp

Create a gulpfile:Using your text editor, create a file named gulpfile.js in your project root with these contents:

function defaultTask(cb) {
  // place code for your default task here
  cb();
}

exports.default = defaultTask

Full Resource here: https://gulpjs.com/docs/en/getting-started/quick-start

Hope this helps ypu

Homework answered 8/1, 2020 at 4:6 Comment(0)
H
0

Thanks for creating this issue, I also had it. The fix for me was to put gulpfile.js in the root directory.

Heiney answered 12/8, 2019 at 7:13 Comment(0)
F
0

After running 'yo' to create your new project, use 'cd' command to jump to the the root directory of your new project, then you can run 'gulp' commands.

Fidellas answered 25/10, 2019 at 14:8 Comment(0)
P
0

My gulpFile.js was not in my root directory as expected!

I had to find the file, change to that directory, and then run gulp forever --react. (I have a React project.)

Pathoneurosis answered 14/11, 2019 at 0:14 Comment(0)
S
0

You must have saved the project files in a subfolder instead of current folder.

Which baseline packages do you want to target for your component(s)?: SharePoint Online only (latest) Where do you want to place the files?: Use the current folder

If you have selected "Create a subfolder with solution name"

Then change the directory cd "path of the project" Then run

gulp trust-dev-cert

gulp serve

Strangles answered 20/3, 2021 at 15:13 Comment(0)
N
0
gulpfile.js > 
const gulp = require('gulp')
gulp.task('style', function () {
console.log(1)
}
> gulp style > 1 // true 
Nonresident answered 20/1, 2022 at 20:59 Comment(1)
See "Explaining entirely code-based answers". While this might be technically correct it doesn't explain why it solves the problem or should be the selected answer. We should educate along with helping solve the problem.Waggon
C
0

Things to consider before running gulp task runner:

gulp filename should be gulpfile.js

gulpfile.js should be in root folder

make sure all tasks performing related libraries are installed eg: gulp-concat, gulp-concat gulp-minify-css

minify css snippet :

var autoprefix = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css');
var concat = require('gulp-concat');
var gulp = require('gulp');


gulp.task('styles', async function () {
    gulp.src(['src/styles/*.css'])
        .pipe(concat('styles.css'))
        .pipe(autoprefix('last 2 versions'))
        .pipe(minifyCSS())
        .pipe(gulp.dest('build/styles/'));
});

Run the required task from root folder where gulfile.js exists

Crossbreed answered 5/6, 2023 at 12:32 Comment(0)
W
-1

If you have the gulpfile in your root directory and there are the tasks so maybe the problem is the version.

I ran gulp -v and the output was:

CLI version: 2.3.0
Local version: 3.9.0

To fix it I ran npm install - [email protected] to keep both the same and the error:

No gulpfile found

Stopped to be shown

Wrap answered 8/6, 2020 at 13:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.