No gulp file found (windows) - gulp

have a problem with gulp. I've been using gulp for 3 months. And for the first time a have an issue like this:
When I try to run gulp, command line shows: no gulp file found. I use node, and I got project from my friend to fix code. Thank, U!

gulp is telling you that it doesn't have a gulpfile with instructions for it to follow. Please make sure you were in correct directory that contains gulpfile.js. It will be better if you could show your project structure here.

Related

How do I fix gulpfile.js to avoid "Did you forget to signal async completion?" when running "gulp ngrok-serve" and DO NOT have the task defined?

I used 2 tutorial clips from Microsoft (first, second) to build a sample Teams Message Extension.
I'm down to the final step of really starting the app with the gulp ngrok-serve command, but I get this error message:
...
[16:05:29] Watching .env
[16:05:29] The following tasks did not complete: ngrok-serve, serve, watch
[16:05:29] Did you forget to signal async completion?
I've read various suggestions on how to fix this, but the problem in my case is that I don't have the "ngrok-serve" task defined in my file. It seems to be running a "default" version of it.
So how should I define/overwrite it, so that I can fix it's implementation, in my gulpfile.js file ?
Thank you.
We were able to run the app successfully using gulp serve, as mentioned in the Build your first Microsoft Teams app using the Yeoman generator documentation. Please run the app using gulp serve.

Gulp bundle --ship: The build failed because a task wrote output to stderr

I've been getting this error when trying to do a gulp bundle --ship command:
The build failed because a task wrote output to stderr.
Exiting with exit code: 1
I'm pretty new to this so have no idea how to proceed with it. It's happening even when I run through the helloworld webpart now. The gulp serve works and I can bundle and package the solution as long as I don't add a --ship to it. I've written and published apps before on the same machine so I don't know what is different now.
I've uninstalled every extension and re-installed the application but it's still doing it. Any help would be appreciated.
Just for quick win you can use --debug flag for bundling task instead of --ship until this bug will be fixed in future releases:
gulp bundle --debug
gulp package-solution --ship
The bundled file will be bigger, but at least you are not getting "The build failed because a task wrote output to stderr" error in CI/CD.
It normally happens because of the warnings. You can add suppression like mentioned below in gulpfile.js
build.addSuppression(Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.);
build.addSuppression(/Warning/gi);
I got this error because caniuse-lite needed a database update. It was confusing because there was no red error message.
Easy fix: npx browserslist#latest --update-db

Gulp sass not compiling properly

So whats happening is when I edit a scss file and save, gulp task runs with no errors but excludes that files content in my main default.css.
I switch to another scss file, edit that and THAT one is now exluded but the previous gets compiled.
gulpfile.js
var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('scss', function () {
return gulp.src('assets/resources/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('assets/css/'));
});
gulp.task('watch', function () {
gulp.watch('assets/resources/**/*.scss', ['scss']);
});
gulp.task('default', ['scss', 'watch']);
No idea whats going on and not even sure if this is the right place to post this but im at my wits end.
Should also note that doing a normal sass watch from the command line works fine, no issues there.
Gulp 3.9.1
Gulp-sass 4.0.1
Node-sass 4.9.0
File structure if it helps
assets/css/default.css
assets/resources/default.scss
assets/resources/base/<scss files>
assets/resources/modules/<scss files>
So the problem was with gulp-sass.
Uninstalled it then installed gulp-ruby-sass, tweaked task based on the help file and it's working perfectly now

Visual Studio 2015 - Where's the gulp task runner?

I heard Mads Kristensen in his videos mention that Gulp and Grunt are both first class citizens. I thought I even heard mention of the Gulp task runner.
But when I create a gulpfile and right click there's no task runner.
Has anyone been able to get the "native" gulp task runner (if there is one) in Visual Studio 2015 Preview to appear?
View > Other Windows > Task Runner Explorer and click refresh
or just Ctrl + Alt + Bkspace
The Preview version of VS2015 requires Gulp to be installed globally and has a few other issues with auto-discovery of the gulpfile.js. These issues will all be addressed by the time VS2015 ships.
I had this same problem with VS2015 - TRX was showing "no tasks found" even though I had a valid, linted, gulpfile.js in the site root. I found the answer here: http://www.roelvanlisdonk.nl/?p=4258
Steps: Close VS. Open a cmd prompt from the site root and run npm install. Re-open VS and you should see your tasks in TRX. It worked for me.
EDIT: I had gulp installed globally but still encountered this "error." The above steps resolved the issue though.
Well I solved the problem with several restarts of VS2015. Finally the task runner appeared for my gulpfile. I still have no idea why it did not appear from the start but it's a preview version so maybe something is not quite right yet.
Barryman9000's answer helped me on the right track. I started with an empty ASP.NET 5 project in VS2015 and had no package.json file at the project root. Running npm install gave me an error message about missing package.json. After adding that file with the default dependencies from another ASP.NET 5 project, the Dependencies started downloading and my gulpfile tasks appeared in the Task Runner Explorer.
In your bash, go to the directory gulpfile.js is installed in and run:
npm install gulp
Why the downvotes? Please read the OP's question and the comments beneath it. Also, note that the answer with, currently, the most points has nothing to do with the question. Also please note that Mads Kristensen himself said that the issue was to install gulp.
Also, as for the commenter "Bonner" of this answer, note that Bash doesn't mean Linux. You can install git bash for Windows and run all of your NPM and Git commands there. Most developers I know use that bash on windows for all npm needs.
Lastly, if your Gulp Task Runner is not working, that is most likely because it is not recognizing your gulpfile. That is due to gulp not being installed. VS2015 didn't always install gulp for you. So the fix was to install gulp globally (As Mads Kristensen said), or directly where your gulpfile is. Also, restarting or re-installing VS sometimes kickstarted the gulp installation if you're lucky.
Conclusion: My answer is the correct answer. I reference the actual OP Question, comments beneath it, Mads Kristensen, and even the accepted answer. Yet, this answer is in the negative and some random answer about how to use the "View" menu in Visual Studio has 40 points.

Gruntfile not found

I am trying to use Sublime Text 2 with Grunt, but I can't get it working.
The watch task is working if I do it on the Windows console (so it is installed correctly), but not in ST, there it says "Gruntfile.js or Gruntfile.coffee not found" (using the Grunt plugin).
I have no idea why, because there is a folder called "build" containing the Gruntfile.js and the other stuff in the project directory.
I tried removing ST and the plugin and installed it again, but still the same problem.
Any ideas?
Gruntfile should be at the root of the project.
http://gruntjs.com/getting-started#the-gruntfile
You can see the exact code that's throwing the error here: https://github.com/tvooo/sublime-grunt/blob/master/main.py#L41