最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Gulp Error: Cannot find module browserify - Stack Overflow

programmeradmin0浏览0评论

Getting the above error when running gulp.

Can't figure out why. I've read a few things such as the gulp.src needs a ./ infront of app.

var gulp       = require('gulp'),
browserify = require('gulp-browserify');

gulp.task('scripts', function () {

gulp.src(['./app/main.js'])
    .pipe(browserify({
        debug: true,
        transform: [ 'reactify' ]
    }))
    .pipe(gulp.dest('./public/'));

});

gulp.task('default', ['scripts']);

Like so..

I've done a npm install so the node module is is where it should be. Its worth pointing out its called gulp-browserify in the node-module.

As well as I've installed browserify globally on my mac.

Let me know your thoughts or if there is any information im missing.

I'm new to react and trying to literally just set up node.js as a backend and create a react environment.

Getting the above error when running gulp.

Can't figure out why. I've read a few things such as the gulp.src needs a ./ infront of app.

var gulp       = require('gulp'),
browserify = require('gulp-browserify');

gulp.task('scripts', function () {

gulp.src(['./app/main.js'])
    .pipe(browserify({
        debug: true,
        transform: [ 'reactify' ]
    }))
    .pipe(gulp.dest('./public/'));

});

gulp.task('default', ['scripts']);

Like so..

I've done a npm install so the node module is is where it should be. Its worth pointing out its called gulp-browserify in the node-module.

As well as I've installed browserify globally on my mac.

Let me know your thoughts or if there is any information im missing.

I'm new to react and trying to literally just set up node.js as a backend and create a react environment.

Share Improve this question edited Dec 7, 2015 at 15:07 Oss 4,3202 gold badges21 silver badges36 bronze badges asked Dec 7, 2015 at 13:52 Max LynnMax Lynn 1,7786 gold badges25 silver badges35 bronze badges 6
  • Nice suggestion but that didn't do it. – Max Lynn Commented Dec 7, 2015 at 13:55
  • Can you post your plete gulp file? – Gerrit Bertier Commented Dec 7, 2015 at 13:56
  • How do you installed that module? – pazitos10 Commented Dec 7, 2015 at 13:57
  • 1 "NOTE: THIS PLUGIN IS NO LONGER MAINTAINED" – robertklep Commented Dec 7, 2015 at 13:57
  • Gerrit, I've updated the ment with everything i've got in my gulp file. I install the module by doing a npm install – Max Lynn Commented Dec 7, 2015 at 13:57
 |  Show 1 more ment

1 Answer 1

Reset to default 5

gulp-browserify was blacklisted by gulp

You need to use browserify with vinyl-source-stream.

var gulp = require('gulp');
var browserify = require('browserify');
var source     = require('vinyl-source-stream');

gulp.task('browserify', function() {
    return browserify({ entries: ["./app/main.js"] })
        .bundle()
        .pipe(source('main.js'))
        .pipe(gulp.dest('./public/')));
});

Read more here.

发布评论

评论列表(0)

  1. 暂无评论