简体   繁体   English

Gulp错误:找不到模块browserify

[英]Gulp Error: Cannot find module browserify

Getting the above error when running gulp. 运行gulp时出现上述错误。

Can't figure out why. 不知道为什么。 I've read a few things such as the gulp.src needs a ./ infront of app. 我读过一些东西,例如gulp.src需要一个./ infront应用程序。

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. 我已经完成了npm安装,所以节点模块就应该在其中。 Its worth pointing out its called gulp-browserify in the node-module. 值得指出的是它在节点模块中称为gulp-browserify。

As well as I've installed browserify globally on my mac. 我已经在Mac上全局安装了browserify。

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. 我是新来的反应者,实际上只是将node.js设置为后端并创建一个反应环境。

gulp-browserify was blacklisted by gulp gulp-browserify gulp-browserify 列入黑名单

You need to use browserify with vinyl-source-stream . 您需要将browserifyvinyl-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 . 在这里阅读更多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM