No gulpfile found

本秂侑毒 提交于 2019-12-08 16:57:01

问题


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 vagrant@1.0.0 No description npm WARN vagrant@1.0.0 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 vagrant@1.0.0 No description npm WARN vagrant@1.0.0 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


回答1:


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!') 
});



回答2:


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.




回答3:


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.




回答4:


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




回答5:


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.




回答6:


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.)




回答7:


It won't find the gulp file if it is spelled Gulpfile.js, either. That capital G has thrown me down a well or two. Really make sure of your syntax!



来源:https://stackoverflow.com/questions/38937095/no-gulpfile-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!