bower-requirejs icon indicating copy to clipboard operation
bower-requirejs copied to clipboard

Better error propagation

Open briantopping opened this issue 9 years ago • 4 comments

Just learning Bower and Node. Wanted to try bower-requirejs, but no errors, just failure. It turns out that I had an error "Cannot read property 'moduleType' of undefined" generated somewhere deep in the code and it wasn't being reported. What ended up being wrong is one of the modules was listed in my bower.json but not actually installed. The error should have said "module not installed", not that some attribute of an uninstalled module was undefined.

So while that's a bug, there's also the issue with the error message not being displayed at all, even when I turned on various command line switches for node.

Please let me know what other information I can provide! thanks for all that you've done on the tool! :+1:

briantopping avatar Jan 08 '15 07:01 briantopping

A simplified test case reproducing the issue would be helpful. Not much we can do from the little practical information you've provided.

sindresorhus avatar Jan 08 '15 07:01 sindresorhus

Thanks for the response. I don't have a clue what I am doing in this world yet, so gonna be pretty useless to fulfill your request (or I would have sent a patch).

I think what happened is I somehow added a dependency and didn't do an install. I don't have any idea how to reproduce it. I figured it out because I did a bower list:

Brians-MBP-2:net.mauswerks.re.web2 topping$ bower list
bower check-new     Checking for new versions of the project dependencies..
net.mauswerks.re.web#0.0.1-SNAPSHOT /Users/topping/dev/re/net.mauswerks.re.web2
├── DataTables not installed <<<<<< this is the problem
├── angular#1.3.4 (1.3.9-build.3756+sha.e079111 available)
├─┬ angular-animate#1.3.4 (1.3.9-build.3756+sha.e079111 available)
│ └── angular#1.3.4 (latest is 1.3.9-build.3756+sha.e079111)
├─┬ angular-bootstrap#0.11.2 (latest is 0.12.0)
│ └── angular#1.3.4 (1.3.9-build.3756+sha.e079111 available)
...

Once I installed DataTables (even though it was installed elsewhere as "datatables"), things started working a little better. It still doesn't work though, back in with the debugger to figure out why.

briantopping avatar Jan 08 '15 07:01 briantopping

node_inspector_and_net_mauswerks_re_web2_ node _225x55

briantopping avatar Jan 08 '15 07:01 briantopping

I think the error handling needs to be better at that line 57 ;)

I don't have a good handle on Bower yet. But my sense is that datatables and DataTables refers to exactly the same package and Bower only sees one or the other of them as "installed" at a time (installing the one that shows as "not installed" seems to just move the "not installed" to the one that was previously showing okay in bower list). The correct answer in my case seems to be to have removed the local reference to DataTables and let the transitive resolution do it's magic.

Hopefully you have enough background information now to connect the dots. If not, I apologize for bothering you. FOSS never works if people don't supply feedback, and sometimes we don't get feedback in the form of nicely built patches with test cases. I did what I could here and hope it helped!

briantopping avatar Jan 08 '15 07:01 briantopping