I am trying to bundle up my app with browserify and am getting this error:
Cannot find module 'jquery' from '/home/test/node_modules/backbone'
Now questions of this nature have been asked before, but the solutions haven't helped me. Perhaps I have somewhat of a unique case.
In another app, running npm install jquery fixed it. I didn't have it in my package.json and I wasn't requiring jquery in any of my files like what's done here. Everything worked.
In this new app, it doesn't. I tried reinstalling jquery with npm. Nothing. Added it to my dependencies in package.json. Nothing. Included it in my code:
$ = require('jquery'); Backbone.$ = $;
Nothing.
Does anyone have experience with this? What could be going wrong?
Edit:
Diff'd the package.json of the jquery module in the working app and the 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 you want more context (line numbers, parent property, and such), I'd be happy to provide that. I just wanted to simplify it - maybe something stands out.
Edit 2:
Changing the "url" param shouldn't changed anything. Replacing the "_from" with the one that works didn't change anything.
Now, I'm wondering why README data is not found. My README files are the same. Granted, I highly doubt that this is the source of the problem.
Edit 3:
My solution was to remove the jquery module and just include jquery.js in my index view. I'm not particularly happy with this, but it works.
I would still like an answer though; curious what was wrong before.
npm linkto symlink a dependency that I was developing outside of npm. Sounds different than your situation though.npm install jqueryfrom the symlink dep fixed the problem... but I would also setup the browserify shim in the dep folder rather than the parent proejct.