Closed crucialfelix closed 9 years ago
Did you copy config.template.js
to config.js
?
I just copied it from https://github.com/neumino/chateau/blob/master/config.template.js
config.template.js is somewhere in the node package. if we just install chateau (-g) then we don't see this file anywhere in order to copy it.
but yes, the config file is there. you can see the error thrown above
Can you check the chmod of the config file? Is it readable?
yes of course it is.
are you testing only from inside of your chateau development copy ?
if we install chateau then we are not inside that folder at all. we are just working on the command line.
in any case passing in -f should work
look at the stack trace, it totally fails and looks in '..//Users/crucial/Sites/crucialjs/config.json'
--- Sites/crucialjs ‹master. M?› » chateau -f /Users/crucial/Sites/crucialjs/config.json
module.js:340
throw err;
^
Error: Cannot find module '..//Users/crucial/Sites/crucialjs/config.json'
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 module.exports
(/usr/local/lib/node_modules/chateau/routes/api.js:7:18)
at module.exports (/usr/local/lib/node_modules/chateau/app.js:7:38)
at Object.
On Thu, Dec 18, 2014 at 5:03 PM, Michel notifications@github.com wrote:
Can you check the chmod of the config file? Is it readable?
— Reply to this email directly or view it on GitHub https://github.com/neumino/chateau/issues/47#issuecomment-67507638.
+1
So I have a hard time reproducing this, but I'm on Linux so things may be slightly different.
Just to be sure, you installed chateau with -g
right?
Is there a config file here: /usr/local/lib/node_modules/chateau/
Anyway, I should probably use __dirname
in the require
, that would probably makes things cleaner (and maybe fix this issue?)
Yes, installed with -g
if you have used npm link on your development version then you may have something different about your working copy then what you've published. On Sun Dec 21 2014 at 1:02:58 PM Michel notifications@github.com wrote:
So I have a hard time reproducing this, but I'm on Linux so things may be slightly different.
Just to be sure, you installed chateau with -g right? Is there a config file here: /usr/local/lib/node_modules/chateau/
Anyway, I should probably use __dirname in the require, that would probably makes things cleaner (and maybe fix this issue?)
— Reply to this email directly or view it on GitHub https://github.com/neumino/chateau/issues/47#issuecomment-67768231.
Is there a config file here: /usr/local/lib/node_modules/chateau/
No. What is in node_modules is whatever you have published on npm
its something in here:
https://github.com/neumino/chateau/blob/master/bin%2Fchateau https://github.com/neumino/chateau/blob/master/app.js#L5
I don't see any config.js in chateau at all. I think you want a config.default.js that you can load if the person doesn't pass one in. and that would be nice: it would just work for most simple test cases.
in the example I posted above I passed in a config file with -f but it is not loading that correctly. its trying to find it inside the node module package.
maybe read this thread: http://stackoverflow.com/questions/10860244/how-to-make-the-require-in-node-js-to-be-always-relative-to-the-root-folder-of-t
it does seem odd to require ../app.js but I guess this does work in nodeland.
On Sun Dec 21 2014 at 1:20:17 PM felix crucialfelix@gmail.com wrote:
Yes, installed with -g
if you have used npm link on your development version then you may have something different about your working copy then what you've published. On Sun Dec 21 2014 at 1:02:58 PM Michel notifications@github.com wrote:
So I have a hard time reproducing this, but I'm on Linux so things may be slightly different.
Just to be sure, you installed chateau with -g right? Is there a config file here: /usr/local/lib/node_modules/chateau/
Anyway, I should probably use __dirname in the require, that would probably makes things cleaner (and maybe fix this issue?)
— Reply to this email directly or view it on GitHub https://github.com/neumino/chateau/issues/47#issuecomment-67768231.
This is a bug, ../app.js is not working in node land magically, it should have been expanding the path to absolute path in the root file before passing it further - it only works to use chateau if you clone down the repo and rename the config file. When I am less burdened with work I will probably send ind a pull request on this.
I just did a clean install and in /usr/lib/node_modules/chateau
, I just copied config.template.js
to config.js
and it worked fine.
michel@xone:~$ which chateau
/usr/bin/chateau
michel@xone:/usr/bin$ ls -al | grep chateau
lrwxrwxrwx 1 root root 39 Feb 7 18:27 chateau -> ../lib/node_modules/chateau/bin/chateau
@neumino It is a pretty dirty way of doing configuration as the files will be overwritten on update. I would suggest following POSIX conventions an auto-symlink to ~/.chateau.js or similar. Renaming things in /usr/lib
is definitely not pretty.
The bug I refer to is right now doing chateau -f ./hello.js
, chateau -f hello.js
, chateau -f /some/path/hello.js
all fails. Meaning the README is either wrong or it is a bug. I would say a bug as renaming system files or things in node_modules is not a good convention, or a convention seen at all.
Oh sorry I didn't see that chateau -f ./hello.js
doesn't work.
I'll look into it this week, I should have some time.
@neumino That would be awesome.
Fixed in 0.3.13.
(thanks to @flienteen)
'0.3.12'
fresh install any command to chateau fails
the config does exist.
I even tried moving it up a directory since that is where it is looking: