kaeff / ruby-bower

A ruby wrapper for Bower
MIT License
13 stars 0 forks source link

ExecJS::ProgramError: Error: Cannot find module 'bower' #1

Open mulderp opened 11 years ago

mulderp commented 11 years ago

When I try to load bower in an IRB shell, I get:

irb(main):002:0> require 'ruby-bower'
=> true
irb(main):003:0> b = Bower.new
=> #
irb(main):004:0> b.list
ExecJS::ProgramError: Error: Cannot find module 'bower'
    from /Users/pmu/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:68:in `extract_result'
    from /Users/pmu/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:28:in `block in exec'
    from /Users/pmu/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
    from /Users/pmu/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:27:in `exec'
    from /Users/pmu/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:19:in `eval'
    from /Users/pmu/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:33:in `call'
    from /Users/pmu/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/ruby-bower-0.0.1/lib/ruby-bower/ruby-bower.rb:27:in `block (2 levels) in '
    from (irb):4
    from /Users/pmu/.rbenv/versions/2.0.0-p0/bin/irb:12:in `
' irb(main):005:0>

Any idea what I can try?

kaeff commented 11 years ago

Hi, sorry for the late response. Right now, the gem just uses node's require to consume Bower, which uses global bower installation. The ultimate goal is to bundle Bower / don't require a global installation, but for now, installing it via npm should do the trick:

npm install -g bower
ALeftHanded commented 5 years ago

Maybe u guys figure it out.

In CMD: npm install -g xxx

Then we get the global install address by 'npm root -g', such as 'C:\Users???\AppData\Roaming\npm\node_modules'

add parameter cwd=r'C:\Users???\AppData\Roaming\npm\node_modules' in complie function. eg: "Obfs_Js=execjs.compile(js, cwd=r'C:\Users\???\AppData\Roaming\npm\node_modules')" ,js is the javascript code.

I solved the problem in that way.