Git Product home page Git Product logo

Comments (10)

curist avatar curist commented on September 26, 2024

As stated in the readme file, grunt-bower assumes you have bower installed globally.
Try npm install -g bower and see if it works.

from grunt-bower.

curist avatar curist commented on September 26, 2024

Personally, I want to handle the package management by command line, so a global installed bower is needed.

If you prefer a more streamlined workflow, take a look at grunt-bower-task.

from grunt-bower.

nrako avatar nrako commented on September 26, 2024

FYI I tried and install of bower globally wont be enough it has to be installed locally npm install bower which is something I would like to avoid.

from grunt-bower.

curist avatar curist commented on September 26, 2024

@nrako can you be more specific on your setup? grunt version, bower version etc.

from grunt-bower.

nrako avatar nrako commented on September 26, 2024

Latest version for everything, but I don't think the problem rely on the version at least if you use npm > 1.0.0. Check this link http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/

from grunt-bower.

curist avatar curist commented on September 26, 2024

I tried several setups, grunt 0.3.7 or 0.4.0, always globally installed bower.
Never have any issue you mentioned.
I'm really trying to tackle this down, but have no idea what's can be wrong here.
Do you need privilege to install bower globally? Something like sudo npm install -g bower?
Do you have $NODE_PATH correctly set?

from grunt-bower.

nrako avatar nrako commented on September 26, 2024

Ah! Okay of course now I understand, you probably have the global node_modules directory in your NODE_PATH.

If you try require.resolve('bower') it probably show up bower from your NODE_PATH.

My NODE_PATH is setup correctly which is empty. NODE_PATH exists mostly for legacy reason and it's highly discouraged to use it. There are many reasons for that, what happening now is one of them.

From nodejs.org

These are mostly for historic reasons. You are highly encouraged to place your dependencies locally in node_modules folders. They will be loaded faster, and more reliably.

from grunt-bower.

curist avatar curist commented on September 26, 2024

I'm not aware of that NODE_PATH is a legacy environment variable, good to learn that!!
Just unset my NODE_PATH and use npm config set prefix MY_NODE_MODULE_PATH, everything work just fine.

But, I can't really see how this is related how you require a globally installed package.
If setup correctly, no matter via $prefix or $NODE_PATH, require('some_package') should just works.

from grunt-bower.

nrako avatar nrako commented on September 26, 2024

No It shouldn't global package are for CLI. If a package is used both as a cli and a local package require()it must be installed both globally and locally, or maybe use npm link (but I wouldn't except for rare case). I learnt something too with npm config set prefix I don't really understand how it solve this but if I were you, I wouldn't change anything, you shouldn't have to.

npm folder — ref first bullet point list.

Maybe you think it is a bit anti-DRY but that just the way npm works, all dependencies of your package should be listed in your package.json.

BTW Grunt adopted an elegant solution to do that (among others) with grunt-cli (-g) and grunt local package where grunt-cli is only a cli interface for the local grunt package, maybe bower will come to that in the future.

from grunt-bower.

curist avatar curist commented on September 26, 2024

Just added bower as dependency to package.json.
Thanks for your time sharing this, much appreciated.

from grunt-bower.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.