maxtaco / coffee-script

IcedCoffeeScript
http://maxtaco.github.com/coffee-script
MIT License
727 stars 58 forks source link

Cannot find module 'iced-coffee-script' when running iced on a iced script #127

Closed kflu closed 9 years ago

kflu commented 10 years ago

I've got the following error:

> iced hi2.iced
Error: Cannot find module 'iced-coffee-script'
  at Function.Module._resolveFilename (module.js:338:15)
  at Function.Module._load (module.js:280:25)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (C:\Users\kk\hi2.iced:1:1)
  at Object.<anonymous> (C:\Users\kk\hi2.iced:1:1)
  at Module._compile (module.js:456:26)

The fix is similar to this issue by setting NODE_PATH. What's weird is that I install coffee and iced the same way, both live in the same globally node_module. But:

Why is that? Could setup take care of that. I can also confirm coffee works without setting NODE_PATH. I'm using Windows 8 x64 bit. Both coffee and iced were installed using npm with -g.

dyoder commented 9 years ago

I just ran into the same problem.

maxtaco commented 9 years ago

Can you show me hi2.iced? Which version of iced are you running?

After a recent refactor (around 1.7.1-e), there is a difference between base CoffeeScript and Iced, in that iced needs access to an external library, called iced-runtime, which can be installed separately. The reason I did this is that the compiler was getting pretty bloated in terms of dependencies. I didn't want to force people using the output of iced --compile to install iced-coffee-script; rather, they can just use iced-runtime instead, which has way fewer dependencies.

To see an example of this approach in action, check out something like the keybase node client. iced-coffee-script is a devDependency if you want to build the thing yourself, but if you just want to run it, iced-runtime is a dependency.

singggum3b commented 9 years ago

same problem here.

maxtaco commented 9 years ago

I thought a little about this, my guess is that there's a version mismatch. You have an old and new version of iced installed, and your shell is finding the old version, while your library path is set to the new version. The new versions (v1.7.1-c and above) include 'iced-runtime', while the old version includes 'iced-coffee-script'.

maxtaco commented 9 years ago

I think I figured it out. Should be closed in v1.7.1-g (01dd7d47a7058ebc0865184e8bc4431cd6cb1a1f). Give it a whirl