javascript - Browserify - cannot find module 'jquery' -


i trying bundle app browserify , getting error:
cannot find module 'jquery' '/home/test/node_modules/backbone'

now questions of nature have been asked before, solutions haven't helped me. perhaps have of unique case.

in app, running npm install jquery fixed it. didn't have in package.json , wasn't requiring jquery in of files what's done here. worked.

in new app, doesn't. tried reinstalling jquery npm. nothing. added dependencies in package.json. nothing. included in code:

$ = require('jquery'); backbone.$ = $;

nothing.

does have experience this? going wrong?

edit:

diff'd package.json of jquery module in working app , current one.

working one:

 "url": "https://github.com/jquery/jquery.git"  "_from": "jquery@*" 

broken one:

 "url": "git+https://github.com/jquery/jquery.git"  "_from": "jquery@>=2.1.0 <3.0.0"  "readme": "error: no readme data found!" 

if want more context (line numbers, parent property, , such), i'd happy provide that. wanted simplify - maybe stands out.

edit 2:

changing "url" param shouldn't changed anything. replacing "_from" 1 works didn't change anything.

now, i'm wondering why readme data not found. readme files same. granted, highly doubt source of problem.

edit 3:

solution remove jquery module , include jquery.js in index view. i'm not particularly happy this, works.

i still answer though; curious wrong before.

this should work npm install --save jquery. seems browserify searches jquery module in backbone location. can find out why ? don't have browserify-shim configuration errors in package.json ?

if still have problem can use browserify-shim point browserify proper location putting in package.json

  "browserify": {     "transform": [       "browserify-shim"     ]   },   "browser": {     "jquery": "./node_modules/yet/old/jquery/location"   } 

Comments