tower-archive / tower

UNMAINTAINED - Small components for building apps, manipulating data, and automating a distributed infrastructure.
http://tower.github.io
MIT License
1.79k stars 120 forks source link

Cannot find module 'tower' #332

Closed pashaie closed 12 years ago

pashaie commented 12 years ago

After installing latest version (0.4.2-14) on win7 64bit, when following http://towerjs.org/ steps. I got error running tower generate scaffold Post title:string body:text belongsTo:user

my steps:

module.js:340 throw err; ^

Error: Cannot find module 'tower' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:362:17) at require (module.js:378:17) at Object. (D:\MyProgramming\js\brick\app\scripts\tower:3:1) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:362:17)

thehydroimpulse commented 12 years ago

Just a side note: The towerjs website is extremely outdated. You should use https://github.com/viatropos/tower the instructions here (though they may be the same in some places it's still best to make sure)

I'm assuming you have installed tower globally? I believe i've had this error a while back but forgot to how I fixed it (I should write it down!).

pashaie commented 12 years ago

Yeah, I installed it with -g. Using steps inside https://github.com/viatropos/tower, process seems to be successful, though step 3 npm install was very long (about 5min) and reported some error and warning in gyp(?) 's rebuild process.

And what cake watch does? after running it, it says Running "watch" task Waiting...

And stays that way, so I exited that process and continued on. Running server, I think there is something wrong, cause when clicking on Posts or Users, nothings happen!

I didn't done any database configuration, just stared mongodb, maybe that's the problem?

thehydroimpulse commented 12 years ago

Yes the gyp (build tool for native modules - though not exclusive to node) will most likely fail if you don't have python and visual studio build tools. If it fails it will use the non-native version which is perfectly fine.

cake watch is an alias command to grunt start --config ./grunt.coffee (grunt is also a build tool but in javascript) which watches your coffeescript files for changes. It will always say "Waiting..." as it's waiting for an event to happen (add file, delete or update your files). This is a common technique called hot push, live reload, etc... and makes it possible to "refresh" your node server without restarting it or losing connections.

We should probably update the docs to mention this as many people were wondering about this. So you need to keep cake watch open when your running your server. You will then (after running cake watch) start your server in another tab, or terminal window.

In windows this is a slight problem as by default cmd, powershell does not have tabs or much customization options. (I personally think the DOS system is pure crap compared to the unix shell - which is amazing!) You can download a program called "Console2" which is better alternative to powershell, and cmd. It supports tabs and many customization options albeit missing some aesthetic touch.

Also the npm install command shouldn't take that long, though it does run several other dependency commands that are unique to tower which do add up. It should take around a minute to complete as far as I can tell.

Your database is not the problem. Tower will automatically connect to mongodb if it's running on the default port. A nice no-config solution.

pashaie commented 12 years ago

Thanks dude, your comments are very helpful. I appreciate it. Looking at chrome console, there is an Ember error.

Uncaught Error: App.UsersIndexView:ember479 - Unable to find template "users/index". Ember.View.Ember.Object.extend.templateForName ember.js:12078 Ember.View.Ember.Object.extend.template ember.js:12026 ComputedPropertyPrototype.get ember.js:2949 get ember.js:1355 Ember.View.Ember.Object.extend.render ember.js:12348 Ember.View.Ember.Object.extend.renderToBuffer ember.js:13017 Ember.View.Ember.Object.extend.createElement ember.js:12814 Ember.View.states.preRender.insertElement ember.js:13702 Ember.View.Ember.Object.extend.invokeForState ember.js:12384 invoke ember.js:3377 iter ember.js:3424 RunLoop.flush ember.js:3480 RunLoop.end ember.js:3396 Ember.run.end ember.js:3588 autorun

There is mentioned file (index.js) in app\public\javascripts\app\views\client\users.

thehydroimpulse commented 12 years ago

Can you find that template file or does it really not exist?

A little bit odd, but when you generate a resource through the scaffolding feature it should generate the templates within app\templates\shared\users\ for example. Within this folder you should have some partial and method views.

If you cannot find these files or they do not exist, try deleting that app and try to re-generate everything. Sometimes this fixes it.

pashaie commented 12 years ago

The folder exists with this files:

To be sure, I deleted app folder and started from towel new app, but still same error. And also cake watch was running. The carious thing is, when starting for first time, some of js files aren't on the server, I think it take time to compile all coffeescripts to js.

thehydroimpulse commented 12 years ago

Ok so I went ahead and tried the same thing with the new version of tower and also get the same error. When you generate new resources be sure to restart the server and the cake process. This will fix a lot of the missing js errors.

I'll try to go through and see what is happening...

pashaie commented 12 years ago

So I will close this issue cause this issue Cannot find module 'tower' has been resolved, thanks to @TheHydroImpulse . But I'll create new issue to address Uncaught Error: App.UsersIndexView:ember479 - Unable to find template "users/index".

Thanks.