Gulp错误:无法找到模块浏览 [英] Gulp Error: Cannot find module browserify
问题描述
无法弄清楚原因。我读过一些东西,比如gulp.src需要一个./ infront的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']);
像这样..
我已经完成了npm安装,所以节点模块应该是它的位置。它值得在节点模块中指出它被称为gulp-browserify。
以及我在我的mac上安装了全球范围的browserify。
让我知道您的想法,或者是否有任何信息丢失。
我是新来的人,试图从字面上将node.js设置为后端并创建一个反应环境。
您需要使用 browserify
与 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 /')));
});
阅读更多 here 。
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.
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.
这篇关于Gulp错误:无法找到模块浏览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!