mikeal / node.couchapp.js

Utility for writing couchapps.
Apache License 2.0
406 stars 78 forks source link

Error on push: Cannot find module 'couchapp' #30

Closed nickperkinslondon closed 12 years ago

nickperkinslondon commented 12 years ago

nick@bigdaddy3:~/workspace/mi6$ ls app.js attachments nick@bigdaddy3:~/workspace/mi6$ curl http://localhost:5984/mi6 {"db_name":"mi6","doc_count":0,"doc_del_count":0,"update_seq":0,"purge_seq":0,"compact_running":false,"disk_size":79,"instance_start_time":"1316825332528937","disk_format_version":5,"committed_update_seq":0} nick@bigdaddy3:~/workspace/mi6$ couchapp push app.js http://localhost:5984/mi6

node.js:134 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: Cannot find module 'couchapp' at Function._resolveFilename (module.js:326:11) at Function._load (module.js:271:25) at require (module.js:355:19) at Object. (/home/nick/workspace/mi6/app.js:1:79) at Module._compile (module.js:411:26) at Object..js (module.js:417:10) at Module.load (module.js:343:31) at Function._load (module.js:302:12) at require (module.js:355:19) at Object. (/usr/local/lib/node_modules/couchapp/bin.js:78:24)

nickperkinslondon commented 12 years ago

Ok, I got past this by doing an "npm install couchapp" at the "user-level" ( not as root ), which put couchapp in my local "node_modules", and now it works.

I still consider this a problem, though, because I did not expect to have to npm install couchapp twice! ( and now I have 2 installs to maintain...this could lead to trouble in the future ) How can I make this all work better?

miccolis commented 12 years ago

I'm also running into this while trying to install recline. As described in the readme I cloned the repo and ran npm link . and while this exposes the couchapp command, when I run it I get the same error as reported above.

Is there some detail missing, or am I misunderstanding something?

max-mapper commented 12 years ago

I think you'll need to do npm install couchapp -g to get the couchapp binary and also npm install couchapp to get the couchapp module into the local node_modules folder

miccolis commented 12 years ago

Yea, just running npm install couchapp from within recline got a node_modules folder setup just next to the recline folder and the application is all setup and working now.

Feels a bit messy to have a random node_modules folder just sitting there when I've already got couchapp install globally. Is there a "right" solution to this?

max-mapper commented 12 years ago

node_modules is a friendly folder :) the right solution is to install it in both places, but I should have a package.json in the recline root folder so that you can install all dependencies via npm install