我使用 yeoman webapp generator 插件成功安装了一个 webapp。
我想将主干和主干.layoutmanager 添加到组合中。
但是当我尝试运行时出现诸如https://github.com/isaacs/npm/issues/3275npm install && bower install
之类的错误。
这是我当前的 main.js
require.config({
paths: {
jquery: '../components/jquery/jquery',
backbone: '../../node_modules/backbone/backbone',
underscore: "../components/underscore/underscore",
layoutmanager: "../../node_modules/backbone.layoutmanager/backbone.layoutmanager",
bootstrap: 'vendor/bootstrap'
},
shim: {
bootstrap: {
deps: ['jquery', 'underscore'],
exports: 'Backbone'
},
layoutmanager: {
deps: ["backbone"],
exports: "Backbone.Layout"
}
},
});
require(['app', 'jquery', 'bootstrap'], function (app, $) {
'use strict';
// use app here
console.log(app);
console.log('Running jQuery %s', $().jquery);
});
我当前的 component.json
{
"name": "learnbackbonelayoutmanager",
"version": "0.0.0",
"dependencies": {
"sass-bootstrap": "~2.3.0",
"requirejs": "~2.1.4",
"modernizr": "~2.6.2",
"jquery": "~1.9.1"
},
"devDependencies": {}
}
我当前的 package.json
{
"name": "learnbackbonelayoutmanager",
"version": "0.0.0",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.0",
"grunt-contrib-copy": "~0.4.0",
"grunt-contrib-concat": "~0.1.2",
"grunt-contrib-coffee": "~0.4.0",
"grunt-contrib-uglify": "~0.1.1",
"grunt-contrib-compass": "~0.1.2",
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-cssmin": "~0.4.1",
"grunt-contrib-connect": "0.1.2",
"grunt-contrib-clean": "0.4.0",
"grunt-contrib-htmlmin": "0.1.1",
"grunt-contrib-imagemin": "0.1.2",
"grunt-contrib-livereload": "0.1.1",
"grunt-bower-hooks": "~0.2.0",
"grunt-usemin": "~0.1.9",
"grunt-regarde": "~0.1.1",
"grunt-requirejs": "~0.3.2",
"grunt-mocha": "~0.2.2",
"grunt-open": "~0.2.0",
"matchdep": "~0.1.1"
},
"engines": {
"node": ">=0.8.0"
}
}
如何设置由定义的 webapp 默认值yo webapp
并仍然添加 Backbone 和 Backbone.LayoutManager ?