Open ramalho opened 13 years ago
You need to either install couchapp globally with npm install -g, or you need to do npm install in the project directory so that it sets it up in the local node_modules.
On Jul 10, 2011, at July 10, 20114:14 AM, ramalho wrote:
Using version ec5852c0161145a0e2b3 (April 28, 2011), I have node.couchapp installed and it runs:
$ couchapp couchapp -- utility for creating couchapps
Usage: couchapp
app.js http://localhost:5984/dbname Commands: push : Push app once to server. sync : Push app then watch local files for changes. boiler : Create a boiler project. $
but when doing a push, node.js cannot find the 'couchapp' module:
$ couchapp push app.js http://localhost:5984/noca0
node.js:181 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: Cannot find module 'couchapp' at Function._resolveFilename (module.js:320:11) at Function._load (module.js:266:25) at require (module.js:364:19) at Object.
(/Users/luciano/prj/ramgarlic/gcode/js/couch/node.couchapp/app.js:1:78) at Module._compile (module.js:420:26) at Object..js (module.js:426:10) at Module.load (module.js:336:31) at Function._load (module.js:297:12) at require (module.js:364:19) at Object. (/Users/luciano/opt/node.couchapp.js/bin.js:68:22) $ Reply to this email directly or view it on GitHub: https://github.com/mikeal/node.couchapp.js/issues/18
I installed the couchapp module today and followed the readme.md
After running:
couchapp boiler project1 and after that couchapp push apps.js http://localhost:5984/testdb I get the same error I followed your advice above (npm install -g couchapp from the repo-clone-directory) but the error does not go away.
Node version: v0.4.9 Couchapp version 7a89ddd7 (26th of Juli 2011)
I'm getting the same error with npm installed globally. I'm executing in a cygwin bash environment in Win7/x64.
Stack trace:
node.js:189
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'couchapp'
at Function._resolveFilename (module.js:317:11)
at Function._load (module.js:262:25)
at require (module.js:346:19)
at Object.<anonymous> (/cygdrive/c/Users/Patrick/code/mycouchapp/app.js:1:86)
at Module._compile (module.js:406:26)
at Object..js (module.js:445:10)
at Module.load (module.js:334:31)
at Function._load (module.js:293:12)
at require (module.js:346:19)
at Object.<anonymous> (/usr/local/lib/node_modules/couchapp/bin.js:68:22)
Local "npm install" seems to work:
enrico@enrico-N53SN:~/dev$ curl -XPUT http://localhost:5984/foo {"ok":true} enrico@enrico-N53SN:~/dev$ couchapp boiler foo enrico@enrico-N53SN:~/dev$ cd foo enrico@enrico-N53SN:~/dev/foo$ npm install ~/app/node.couchapp.js couchapp@0.7.1 ./node_modules/couchapp ├── request@2.0.1 └── watch@0.3.2 enrico@enrico-N53SN:~/dev/foo$ couchapp push app.js http://localhost:5984/foo Preparing. Serializing. PUT http://localhost:5984/foo/_design/app Finished push. 1-cce331cdd53540f5056fe28ea496f8e0
node is v0.4.10
Edit: also "npm install couchapp" works, at least after I did "npm install -g" in the couchapp dir Don't know if the "nmp link ." in the readme.md would have been enough to avoid "npm install ~/app/node.couchapp.js"
Thanks enriirne! Installing locally for me failed the first two times, then worked. (I literally ran npm install couchapp
3x and it only succeeded on the third try.) The failures looked something like:
npm ERR! tar "-mvxpf" "-" "-o" "-C" "/cygdrive/c/Users/Patrick/code/mycouchapp/node_modules/couchapp/node_modules/___request.npm" tar: Unexpected EOF in archive
Incidentally, I get a "Domain name not found" error after couchapp successfully installed locally, but replacing localhost with 127.0.0.1 fixed that issue for me (on Win7/x64 w/ cygwin.)
I had the same problem after installing couchapp globally (sudo npm install -g couchapp) in Xubuntu 10.04, resolved it by setting the NODE_PATH environment variable:
export NODE_PATH=/usr/local/lib/node_modules
See also the 'npm help folders' command under 'Global Installation'
http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/
Based on that blog entry it is recommended couchapp be installed both locally and globally.
Globally to use on the command line Locally to require('couchapp') in app.js
if you prefer to go against this recommendation - and only install locally - I would look at comparing where npm installed couch-app and the output of console.log(require.paths)
Adding NODE_PATH also solved it for me with a global install
Agree with halfbaked. Adding NODE_PATH does not help in Windows. Node forces you to have multiple copies of global modules: one as an application and one as a module for your app.
Solution for Windows PowerShell: $env:node_path="$home\AppData\Roaming\npm\node_modules"
"npm intstall couchapp -g" is storing modules into AppData. npm displays this path when installing couchapp.
I wrote a post with some details here: http://georgik.sinusgear.com/2012/11/03/cannot-find-module-couchapp-solution/
Using version ec5852c0161145a0e2b3 (April 28, 2011), I have node.couchapp installed and it runs:
$ couchapp couchapp -- utility for creating couchapps
Usage: couchapp app.js http://localhost:5984/dbname
Commands: push : Push app once to server. sync : Push app then watch local files for changes. boiler : Create a boiler project. $
but when doing a push, node.js cannot find the 'couchapp' module:
$ couchapp push app.js http://localhost:5984/noca0
node.js:181 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: Cannot find module 'couchapp' at Function._resolveFilename (module.js:320:11) at Function._load (module.js:266:25) at require (module.js:364:19) at Object. (/Users/luciano/prj/ramgarlic/gcode/js/couch/node.couchapp/app.js:1:78)
at Module._compile (module.js:420:26)
at Object..js (module.js:426:10)
at Module.load (module.js:336:31)
at Function._load (module.js:297:12)
at require (module.js:364:19)
at Object. (/Users/luciano/opt/node.couchapp.js/bin.js:68:22)
$