Yeoman: using yo webapp followed by adding backbone and backbone.layoutmanager to the connection

I have successfully installed webapp using the yeoman webapp generator plugin.

I wanted to add basic and backbone.layoutmanager to the mix.

But when I try to run npm install && bower install I get errors like https://github.com/isaacs/npm/issues/3275 .

This is my current 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); }); 

My current component is .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": {} } 

My current .json package

 { "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" } } 

How to configure the default web application as defined by yo webapp and add Backbone and Backbone.LayoutManager to it?

+4
source share
1 answer

It seems you have installed the spine and layoutmanager via npm . If you want to use them as interface components, you must install them through bower :

 bower install --save backbone layoutmanager 

After that, adjust the paths in main.js as follows:

 require.config({ paths: { jquery: '../components/jquery/jquery', backbone: '../../components/backbone/backbone', underscore: '../components/underscore/underscore', layoutmanager: '../components/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); }); 
+3
source

All Articles