Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Can't make it work with meteor. #34

Closed
crapthings opened this Issue · 24 comments

3 participants

@crapthings

i had this step done
ln -s /path/to/blade/meteor /path/to/meteor/packages/blade

and when i execute meteor add blade

it just tells me

bogon:app crapthings$ meteor add blade

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'blade'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at /usr/local/meteor/packages/blade/package.js:2:13
at [object Object].init_from_library (/usr/local/meteor/app/lib/packages.js:104:5)
at Object.get (/usr/local/meteor/app/lib/packages.js:222:11)
at /usr/local/meteor/app/lib/packages.js:273:30
at Array.forEach (native)
at Function. (/usr/local/meteor/app/lib/third/underscore.js:76:11)

@bminer bminer was assigned
@bminer
Owner

What is the actual command you entered? ln -s /path/to/blade/meteor /path/to/meteor/packages/blade should be replaced with the actual path to Blade and the actual path to Meteor, which varies from system to system. In most cases, Blade is installed in /usr/lib/node_modules/blade. Not sure about Meteor. Looks like /usr/local/meteor on your system?

@crapthings

desktop crapthings$ ln -s /Users/crapthings/Desktop/blade/meteor /usr/local/meteor/packages/blade

@bminer
Owner

ok, cool. What OS are you using? What version of Node, npm, Meteor, and Blade are you running?

This is my environment:

$ cat /etc/issue
Ubuntu 12.04 LTS
$ node -v
v0.6.19
$ npm -v
1.1.24
$ blade -V
1.3.4

Also, what is the output of ls -al /usr/local/meteor/packages/blade/*?

What about ls -al /usr/local/meteor/packages/blade?

@crapthings

os x lion 10.7.4

node -v
v0.6.19

npm -v
1.1.24

where can i run blade ?

i downloaded source from your git page, and unzipped to desktop then rename it to blade

cd blade
cd bin
./blade -v

bogon:bin crapthings$ ./blade -v

module.js:337
throw new Error("Cannot find module '" + request + "'");
^
Error: Cannot find module 'commander'
at Function._resolveFilename (module.js:337:11)
at Function._load (module.js:279:25)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object. (/Users/crapthings/Desktop/blade/bin/blade:6:12)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Array.0 (module.js:484:10)

bogon:blade crapthings$ ls -al /usr/local/meteor/packages/blade/*

-rwxr-xr-x@ 1 crapthings staff 3238 Jun 8 05:52 /usr/local/meteor/packages/blade/package.js
-rwxr-xr-x@ 1 crapthings staff 339 Jun 8 05:52 /usr/local/meteor/packages/blade/runtime-meteor.js
lrwxr-xr-x@ 1 crapthings staff 17 Jun 11 20:14 /usr/local/meteor/packages/blade/runtime.js -> ../lib/runtime.js

bogon:blade crapthings$ ls -al /usr/local/meteor/packages/blade?

ls: /usr/local/meteor/packages/blade?: No such file or directory

do i have to sudo to run that ln -s ???

@bminer
Owner

Your symlink appears to be working, so that's good.

A couple of things...

Blade is intended to be installed using npm, which is probably why it's complaining a bit. Easiest way to install is sudo npm install -g blade. Also, the Github repo does not contain any of Blade's dependencies. These are typically taken care of by npm. That's why you get the Error: Cannot find module 'commander'. If you don't want to fully install, you can do npm install in the blade directory on your desktop. That installs dependencies... I think.

The next problem is that the Blade smart package also expects Blade to be installed using npm (see meteor/meteor#152 (comment)). So, you may need to add blade to your NODE_PATH env variable when you run meteor run. Or, just simply install using npm.

The easy way to fix your problem is to install blade using npm, as described above. Of course, be sure to update your symlink to point to the path where npm installed blade. npm will tell you where it's going during the install.

The hard way to fix your problem is to beat your head against the wall until it all magically works. :)

@bminer
Owner

Please keep me posted on this issue, and let me know if I can help further. I am closing this issue for now. Thanks!

@bminer bminer closed this
@TrevorBurnham

I'm experiencing the same issue. Also under OS X. I used npm install -g blade, then created the symlink. I can require('blade') just fine from the Node REPL. For that matter, the require line is unproblematic if I run node /usr/local/meteor/packages/blade/package.js. So it must have something to do with the funky require that's injected by meteor/app/lib/packages.js. Beyond that, I'm baffled.

@TrevorBurnham

I was able to work around the issue by running

npm install blade

from meteor's directory, creating a node_modules subdirectory of /usr/local/meteor/ that gets found by the require. This is still an issue worth fixing, though. I'll have to run this workaround every time I update to a new version of meteor.

@TrevorBurnham

Figured out the issue: Global npm installations only work when the system variable NODE_PATH points to that directory. The meteor binary overrides this value: https://github.com/meteor/meteor/blob/v0.3.7/meteor#L105

@bminer
Owner

@TrevorBurnham - hmmm... interesting. Thanks for the info, Trevor. Is there anything I can do as a Meteor smart package author to fix this issue?

@bminer bminer reopened this
@TrevorBurnham

Well, the issue would be moot if Blade were added to meteor officially as a smart package. You'd just have to add

npm install blade@1.3.4

to admin/generate-dev-bundle.sh.

For now, I'd say your best option is to replace the current postinstall script

ln -s ../lib/runtime.js ./meteor/runtime.js

with one that would symlink the entire lib dir

ln ln -s ../lib ./meteor/lib

and then change package.js so that it does

require('./lib/blade')

I believe you'd also have to change the reference to 'runtime.js' to './lib/runtime.js'.

Disclaimer: I'm not a member of the meteor team, just a fan. So you might get better suggestions if you ask them on IRC.

@crapthings

okay i'm a little bit mess, how to make it work?

  1. curl install.meteor.com | /bin/sh
  2. npm install -g blade ?
  3. ln -s ?
@bminer bminer closed this issue from a commit
@bminer Fixed misc. issues with Meteor integration (fixes #34)
Remove `meteor/runtime.js` symlink and just have `meteor/package.js` locate it
Temporarily add `node_modules` directory to `meteor` until smart package is added to Meteor
Post install script now installs symlink for entire Blade library into `node_modules` directory
Push to 1.3.5
93fd3b4
@bminer bminer closed this in 93fd3b4
@bminer
Owner

Guys -- I think I fixed all of the problems. Could you please test it for me? @TrevorBurnham - I added node_modules directory to the meteor smart package directory and created a symlink back to the Blade package.

So Meteor + Blade install should be:

  1. Install Meteor - curl install.meteor.com | /bin/sh -- since Meteor doesn't ship with Blade yet, we need to do more work.
  2. Install Blade - npm install -g blade
  3. Add symlink ....../meteor/packages/blade should point to ....../blade/meteor. So, run something like ln -s /usr/lib/node_modules/blade/meteor /usr/lib/meteor/packages/blade -- substituting your actual install paths of Meteor and Blade, as appropriate.
  4. Run meteor add blade on your Meteor project
  5. Test, then post your comments below. :)
@TrevorBurnham

Unfortunately, the fix doesn't work. Same error. The problem is that the require in package.js isn't the require that you'd get in that file normally; it's actually the require from meteor's app/lib/packages.js, which means that it'll only look for app/lib/node_modules, app/node_modules, etc.

@crapthings

same thing happen, when i execute meteor add blade

curl install meteor and npm install blade with -g then ln -s two path

meteor create app
cd app
meteor add blade

bogon:app crapthings$ meteor add blade

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'blade'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at /usr/local/meteor/packages/blade/package.js:2:13
at [object Object].init_from_library (/usr/local/meteor/app/lib/packages.js:104:5)
at Object.get (/usr/local/meteor/app/lib/packages.js:222:11)
at /usr/local/meteor/app/lib/packages.js:273:30
at Array.forEach (native)
at Function. (/usr/local/meteor/app/lib/third/underscore.js:76:11)
bogon:app crapthings$

and i don't have node_modules in /usr/lib but in /usr/local/lib

with that folder there're node and node_modules... i can see blade under node_modules.

meteor is here /usr/local/meteor and when i finished ln -s i can see blade is under the packages folder.

still can't get it working.

blade --version = 1.3.7

@TrevorBurnham

[Continuing my previous post] So the relative require would be

var blade = require('../../packages/blade/node_modules/blade');

given the current directory structure. Gross, right? But I've tried it, and it appears to work.

@bminer
Owner

Sorry, guys. I can't replicate the bug you're getting, but I imagine that you're right on.

@TrevorBurnham - Damn. I was trying desperately to avoid that stupid hack. That is really, really lame... I guess I'll do try, catch block around require('blade') and then do require('../../packages/blade/node_modules/blade'). Bummer. Fix coming soon. Thanks for your patience.

@TrevorBurnham

Yeah, definitely bug the Meteor team about this. In principle, they want to provide templating options. In practice, they're doing an awful lot of special-casing for their Handlebars package.

@bminer
Owner

@TrevorBurnham - you can say that again. This isn't the only issue either. Although, I think the Meteor guys are aware of some of the problems. For example, they put comments in their code in appropriate spots:

Those are the two primary annoyances that I've encountered, and they've called them out in their source code.

@bminer bminer referenced this issue from a commit
@bminer Another attempt at fixing issue #34. Hopefully, Blade + Meteor works …
…as expected now.

Push to 1.3.8
0cf6b45
@bminer
Owner

OK. Blade 1.3.8 is now available. Hopefully, this really fixes the problem.

@bminer
Owner

I'm going to re-open this until I hear back from you guys. Thanks for your help!

@bminer bminer reopened this
@TrevorBurnham

Works, thanks.

@bminer
Owner

Cool. Thanks, @TrevorBurnham. @crapthings - if you have any more issues, please let me know. Thanks again for your help, guys.

@bminer bminer closed this
@crapthings

good job blake it's working!

Zhangs-MacBook-Pro:app crapthings$ meteor add blade
blade: Blade - HTML Template Compiler, inspired by Jade & Haml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.