我正在运行“grunt”的目录有 node_module 文件夹,其中包含所有模块,包括:Bootstrap、Browserify 等。
当我运行“咕噜”
我得到:
Running "jshint:files" (jshint) task
>> 12 files lint free.
Running "copy:build" (copy) task
Created 1 directories, copied 17 files
Running "concat:vendorcss" (concat) task
File "build-css/vendor.less" created.
Running "less:libremap" (less) task
File build/css/libremap.css created.
Running "jst:compile" (jst) task
File "build-jst/templates.js" created.
Running "browserify:vendor" (browserify) task
>> Bundled build/vendor/vendor.js
Running "browserify:libremap" (browserify) task
Warning: Cannot find module 'bootstrap' Use --force to continue.
它停在browserify并说在这种情况之前找不到模块'bootstrap',它说在重新启动“grunt”后没有我用“npm install jquery”安装的“jquery”,随后还报告了一些其他丢失的模块我安装了。但是使用引导程序,即使在安装并确保它存在于 node_modules 目录之后,我仍然有这个错误。
任何帮助将不胜感激。
我是 grunt、npm、nodejs 等的新手。我只是想设置一个软件。
附加任务代码。
有两个 Browserify 任务,我假设第一个从上面的输出成功完成?
browserify: {
vendor: {
src: [],
dest: 'build/vendor/vendor.js',
options: {
shim: {
jquery: {
path: 'bower_components/jquery/jquery.min.js',
exports: '$'
},
bootstrap: {
path: 'bower_components/bootstrap/dist/js/bootstrap.min.js',
exports: 'bootstrap',
depends: {
'jquery': 'jQuery'
}
},
leaflet: {
path: 'vendor/leaflet/leaflet.js',
exports: 'L'
},
'leaflet-markercluster': {
path: 'vendor/leaflet.markercluster/leaflet.markercluster.js',
exports: 'L',
depends: {
'leaflet': 'L'
}
}
}
}
},
// browserify libremap.js -> bundle.js
libremap: {
dest: 'build/js/libremap.js',
src: [ 'src/js/libremap.js' ],
options: {
debug: grunt.option('debug'),
external: ['jquery', 'bootstrap', 'leaflet', 'leaflet-markercluster'],
shim: {
templates: {
path: 'build-jst/templates.js',
exports: 'JST',
depends: {
'underscore': '_'
}
}
}