Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Resolvers need to be globally installed. #1919

Closed
gaurav21r opened this issue Sep 14, 2015 · 12 comments
Closed

Custom Resolvers need to be globally installed. #1919

gaurav21r opened this issue Sep 14, 2015 · 12 comments

Comments

@gaurav21r
Copy link

I was trying to make my own resolver.

I found that only when I installed my Custom Resolver globally using npm -g did it work.

I'm on Windows. On trying to use local resolvers, I am getting:

bower MODULE_NOT_FOUND Cannot find module 'test-resolver'

@sheerun
Copy link
Contributor

sheerun commented Sep 14, 2015

You have few options:

  1. Install both resolver and bower locally
  2. Install bower locally and resolver globally
  3. Install bower and resolver globally

The only option that doesn't work is installing bower globally and resolver locally. Maybe we could fix that. I'm not sure.

Things get more complicated when npm link is used :)

@gaurav21r
Copy link
Author

@sheerun I understand that this investigation can take some time. Can we please include this in the documentation for Custom Resolvers ??

@sheerun
Copy link
Contributor

sheerun commented Sep 14, 2015

Yes, but I need to confirm those cases before documenting them publicly :)

@andrey-p
Copy link

Please add documentation, I just got tripped up by this too.

@ptitgraig
Copy link

This issue can be close since it's documented now.
https://github.com/bower/bower.github.io/blob/master/docs/pluggable-resolvers.md

@benmann
Copy link
Member

benmann commented Dec 17, 2015

Agree.. Closing.

@benmann benmann closed this as completed Dec 17, 2015
@andrey-p
Copy link

Sorry, I'm not sure if the actual problem @gaurav21r and I had was documented.

The usage section that @ptitgraig linked to mentions that you can use resolvers globally or locally, but doesn't go into more detail. Specifically it doesn't mention that you have to install the resolver globally if bower is installed globally.

@benmann
Copy link
Member

benmann commented Dec 17, 2015

Oh, I get it. I thought the first sentence is enough, stating to install globally, but I see where you're coming from. I'll keep it open, also because

Maybe we could fix that.

@benmann benmann reopened this Dec 17, 2015
@andrey-p
Copy link

Thanks. Appreciate your work on this! 🙇

@ptitgraig
Copy link

Indeed, my mistake.

@wrumsby
Copy link

wrumsby commented Feb 1, 2016

Maybe we could fix that.

Is fixing that as simple as trying something like trying to require the resolver and if that fails resolve it relative to cwd?

(Having said that I can't immediately see the code that's loading these resolvers.)

@sheerun
Copy link
Contributor

sheerun commented Feb 1, 2016

It's line 60 of resolverFactory.js (simple require call). I think your approach would fix it (require ${cwd}/node_modules/${resolverName} and then fallback to normal require for global resolvers).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

7 participants