tmeasday / meteor-router

MIT License
366 stars 76 forks source link

Type Error: First argument must be a string or Buffer #130

Closed sandeep-v2 closed 11 years ago

sandeep-v2 commented 11 years ago

I am using Meteor-router with Meteor version 0.6.5.1 like below:

Meteor.Router.add({ '/': function(){return 'items'} });

But browser loading only template name and getting following error: Meteor server restarted W20130904-10:28:11.960(5.5)? (STDERR) TypeError: first argument must be a string or Buffer W20130904-10:28:12.024(5.5)? (STDERR) at ServerResponse.OutgoingMessage.write (http.js:749:11) W20130904-10:28:12.025(5.5)? (STDERR) at ServerResponse.module.exports.res.write (/home/subhash/.meteor/packages/webapp/820d0690df/npm/node_modules/connect/lib/middleware/compress.js:92:17) W20130904-10:28:12.025(5.5)? (STDERR) at ServerResponse.module.exports.res.end (/home/subhash/.meteor/packages/webapp/820d0690df/npm/node_modules/connect/lib/middleware/compress.js:96:23) W20130904-10:28:12.025(5.5)? (STDERR) at Router._start (packages/router/lib/router_server.js:127)

tmeasday commented 11 years ago

Looks fine to me .. is it in a client directory?

sandeep-v2 commented 11 years ago

No, both html and js files are in root directory.

tmeasday commented 11 years ago

Ahh, you'll want to wrap your code in

if (Meteor.isClient)

then

On Wednesday, 4 September 2013 at 3:58 PM, Sandeep-V2 wrote:

No, both html and js files are in root directory.

— Reply to this email directly or view it on GitHub (https://github.com/tmeasday/meteor-router/issues/130#issuecomment-23767650).

sandeep-v2 commented 11 years ago

yes...is it happening because of server or client scope?

Please get my app code here: https://github.com/sandeep-v2/meteor-0.6.5.1-with-router

tmeasday commented 11 years ago

Meteor.Router.add doesn't work on the server

On Wednesday, 4 September 2013 at 4:08 PM, Sandeep-V2 wrote:

yes...is it happening because of server or client scope?

— Reply to this email directly or view it on GitHub (https://github.com/tmeasday/meteor-router/issues/130#issuecomment-23767930).

sandeep-v2 commented 11 years ago

Now it is working, thank alot.

I have one more query in my another application I am using Iron-router for Meteor-0.6.5.1, but when I am trying to start the server it not working, in console seeing server is trying to restart n times and at the end i need to hit ctrl+z to stop it: Please help me on this:

subhash@v2-desktop ~/workzone/iron-test $ meteor run --port 3020 [[[[[ ~/workzone/iron-test ]]]]]

=> Meteor server running on: http://localhost:3020/ => Meteor server restarted (x55)^Z

Track the app code here: https://github.com/sandeep-v2/meteor-0.6.5.1-with-iron-router

tmeasday commented 11 years ago

Hi, Can you open this as a bug against IR please?

sandeep-v2 commented 11 years ago

Hey, again a road blocker -

Now getting following error when trying to start a server -

[[[[[ ~/workzone/meteor-0.6.5.1-with-router ]]]]]

/home/subhash/.meteor/tools/3cba50c44a/tools/run.js:425 throw e; ^ Error: ENOENT, no such file or directory '/home/subhash/workzone/meteor-0.6.5.1-with-router/packages/HTML5-History-API/.build/unipackage.json'

at Object.fs.openSync (fs.js:338:18)