You need to install the module inside your project, not inside your global node folder. While there are a few exceptions, dependencies are generally installed on a per-project/module/package basis.
If this is your first foray into node, you might be better served by following a more generic intro to node tutorial instead of the couchbase tutorial that appears to assume prior knowledge of node. I'm not familiar with any of them, but I'm sure someone on the list can come up with a few. ~Ryan On Tue Jan 20 2015 at 7:05:58 AM Ken Wayne <[email protected]> wrote: > Thanks Ryan, > I tried version 1.0 but continue to get errors. I was able to install > v1.1 without errors but still can't get the couchbase example to work. Any > further suggestions? > > ***** Output from test: ***** > C:\Users\kwayne\NodeTest>dir > Volume in drive C is KensCoolPC > Volume Serial Number is F07B-011A > > Directory of C:\Users\kwayne\NodeTest > > 01/19/2015 02:55 PM <DIR> . > 01/19/2015 02:55 PM <DIR> .. > 01/19/2015 01:33 PM 770 hello-couchbase.js > 01/19/2015 03:54 PM 582 test.js > 2 File(s) 1,352 bytes > 2 Dir(s) 25,553,969,152 bytes free > > C:\Users\kwayne\NodeTest>node hello-couchbase.js > > module.js:340 > throw err; > ^ > Error: Cannot find module 'couchbase' > 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 Object.<anonymous> > (C:\Users\kwayne\NodeTest\hello-couchbase.js:1:79) > at Module._compile (module.js:456:26) > at Object.Module._extensions..js (module.js:474:10) > at Module.load (module.js:356:32) > at Function.Module._load (module.js:312:12) > at Function.Module.runMain (module.js:497:10) > > C:\Users\kwayne\NodeTest> > > ***** Output from install v1.1 ***** > > > c:\Program Files (x86)\nodejs>npm install [email protected] > | > > [email protected] install c:\Program Files > (x86)\nodejs\node_modules\couchbase > > (node-gyp rebuild 2> builderror.log) || (exit 0) > > > c:\Program Files (x86)\nodejs\node_modules\couchbase>node "c:\Program > Files (x86 > > )\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node > -gyp.js" rebuild > Building the projects in this solution one at a time. To enable parallel > build, > please add the "/m" switch. > client.c > common.c > hmac.c > md5.c > cbsasl.vcxproj -> c:\Program Files > (x86)\nodejs\node_modules\couchbase\build\ > Release\\libcbsasl.lib > Copying plugins/io/libuv/libuv_io_opts.h to > include/libcouchbase/libuv_io_opt > s.h > 1 file(s) copied. > Copying plugins/io/libuv/plugin-internal.h to > include/libcouchbase/plugins/io > /libuv/plugin-internal.h > 1 file(s) copied. > Copying plugins/io/libuv/plugin-libuv.c to > include/libcouchbase/plugins/io/li > buv/plugin-libuv.c > 1 file(s) copied. > plugin-select.c > arithmetic.c > base64.c > bconf_io.c > bconf_parse.c > bconf_provider.c > cntl.c > compat.c > config_cache.c > connect.c > cookie.c > durability.c > error.c > flush.c > genhash.c > get.c > gethrtime.c > handler.c > hashset.c > hashtable.c > http.c > http_io.c > http_parse.c > instance.c > iofactory.c > list.c > observe.c > packet.c > readwrite.c > remove.c > ringbuffer.c > sanitycheck.c > server.c > server_connect.c > server_io.c > server_parse.c > stats.c > store.c > strerror.c > synchandler.c > timer.c > timings.c > touch.c > url_encoding.c > utilities.c > verbosity.c > wait.c > iocp_iops.c > iocp_loop.c > iocp_timer.c > iocp_util.c > couchbase.vcxproj -> c:\Program Files > (x86)\nodejs\node_modules\couchbase\bui > ld\Release\\libcouchbase.lib > crc32.c > crc32.vcxproj -> c:\Program Files > (x86)\nodejs\node_modules\couchbase\build\R > elease\\libcrc32.lib > http_parser.c > httpparser.vcxproj -> c:\Program Files > (x86)\nodejs\node_modules\couchbase\bu > ild\Release\\libhttpparser.lib > ketama.c > ketama.vcxproj -> c:\Program Files > (x86)\nodejs\node_modules\couchbase\build\ > Release\\libketama.lib > cJSON.c > vbucket.c > vbucket.vcxproj -> c:\Program Files > (x86)\nodejs\node_modules\couchbase\build > \Release\\libvbucket.lib > couchbase_impl.cc > control.cc > constants.cc > namemap.cc > cookie.cc > commandbase.cc > commands.cc > exception.cc > options.cc > cas.cc > valueformat.cc > uv-plugin-all.c > Creating library c:\Program Files > (x86)\nodejs\node_modules\couchbase\buil > d\Release\couchbase_impl.lib and object c:\Program Files > (x86)\nodejs\node_mo > dules\couchbase\build\Release\couchbase_impl.exp > Generating code > Finished generating code > couchbase_impl.vcxproj -> c:\Program Files > (x86)\nodejs\node_modules\couchbas > e\build\Release\\couchbase_impl.node > [email protected] node_modules\couchbase > └── [email protected] > > c:\Program Files (x86)\nodejs> > > > > On Mon, Jan 19, 2015 at 7:55 PM, Ryan Graham <[email protected]> wrote: > >> Looks like the API changed in [email protected] (released in November), >> but I can't find a changelog or API docs in the repo. So +1 for following >> semver and -1 for documenting the breaking change? I didn't look hard, >> could be somewhere other than the repo: >> https://github.com/couchbase/couchnode >> >> Either way, if you change your dependency to couchbase@^1.0.0 (npm >> install "couchbase@^1.0.0" should do it) the example code you are >> following will probably "just work" as intended. >> >> ~Ryan >> >> On Mon Jan 19 2015 at 5:41:52 PM Ken Wayne <[email protected]> wrote: >> >>> I'm trying to follow the tutorial here: >>> http://docs.couchbase.com/couchbase-sdk-node-1.2/ >>> >>> I'm using the most recent version of Node. I get the following >>> exception when I try to run the example: >>> C:\Program Files (x86)\nodejs\Ken\hello-couchbase.js:3 >>> var bucket = new couchbase.Connection({ >>> ^ >>> TypeError: undefined is not a function >>> at Object.<anonymous> (C:\Program Files >>> (x86)\nodejs\Ken\hello-couchbase.js: >>> 3:14) >>> at Module._compile (module.js:456:26) >>> at Object.Module._extensions..js (module.js:474:10) >>> at Module.load (module.js:356:32) >>> at Function.Module._load (module.js:312:12) >>> at Function.Module.runMain (module.js:497:10) >>> at startup (node.js:119:16) >>> at node.js:929:3 >>> >>> I didn't get any errors when running "npm install couchbase" but did >>> get a number of warnings (below). Any thoughts on what I should do? >>> >>> npm install couchbase >>> >>> >>> >>> > [email protected] install C:\Program Files >>> (x86)\nodejs\node_modules\couchbase >>> > (node-gyp rebuild 2> builderror.log) || (exit 0) >>> >>> >>> C:\Program Files (x86)\nodejs\node_modules\couchbase>node "C:\Program >>> Files >>> (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" >>> rebuild >>> Warning: Missing input files: >>> C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\deps\lcb\..\..\..\deps\lcb\contrib\cbsasl\src\config.h >>> C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\deps\lcb\..\..\..\deps\lcb\contrib\cbsasl\include\cbsasl\visibility.h >>> Building the projects in this solution one at a time. To enable parallel >>> build, please add the "/m" switch. >>> client.c >>> common.c >>> hmac.c >>> md5.c >>> cbsasl.vcxproj -> C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\Release\\libcbsasl.lib >>> cJSON.c >>> cjson.vcxproj -> C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\Release\\libcjson.lib >>> Copying plugins/io/libuv/libuv_io_opts.h to >>> include/libcouchbase/libuv_io_opts.h >>> 1 file(s) copied. >>> Copying plugins/io/libuv/plugin-internal.h to >>> include/libcouchbase/plugins/io/libuv/plugin-internal.h >>> 1 file(s) copied. >>> Copying plugins/io/libuv/plugin-libuv.c to >>> include/libcouchbase/plugins/io/libuv/plugin-libuv.c >>> 1 file(s) copied. >>> Copying plugins/io/libuv/libuv_compat.h to >>> include/libcouchbase/plugins/io/libuv/libuv_compat.h >>> 1 file(s) copied. >>> netbuf.c >>> mcreq.c >>> compress.c >>> forward.c >>> rope.c >>> bigalloc.c >>> chunkalloc.c >>> libcalloc.c >>> lcbht.c >>> http_parser.c >>> counter.c >>> get.c >>> touch.c >>> observe.c >>> durability.c >>> store.c >>> ..\..\..\deps\lcb\src\operations\durability.c(534): warning C4244: >>> 'initializing' : conversion from 'double' to 'lcb_SIZE', possible loss of >>> data [C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\deps\lcb\couchbase.vcxproj] >>> stats.c >>> remove.c >>> pktfwd.c >>> bc_cccp.c >>> bc_http.c >>> bc_file.c >>> bc_mcraw.c >>> confmon.c >>> bootstrap.c >>> callbacks.c >>> cntl.c >>> dump.c >>> connspec.c >>> ..\..\..\deps\lcb\src\cntl.c(456): warning C4244: '=' : conversion from >>> 'double' to 'unsigned long', possible loss of data [C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\deps\lcb\couchbase.vcxproj] >>> ..\..\..\deps\lcb\src\cntl.c(494): warning C4244: '=' : conversion from >>> 'double' to 'float', possible loss of data [C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\deps\lcb\couchbase.vcxproj] >>> handler.c >>> getconfig.c >>> http.c >>> http_io.c >>> instance.c >>> legacy.c >>> negotiate.c >>> mcserver.c >>> ..\..\..\deps\lcb\src\legacy.c(171): warning C4996: 'lcb_timer_destroy': >>> was declared deprecated [C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\deps\lcb\couchbase.vcxproj] >>> C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\deps\lcb\include\libcouchbase/deprecated.h(101) >>> : see declaration of 'lcb_timer_destroy' >>> ..\..\..\deps\lcb\src\legacy.c(403): warning C4996: >>> 'lcb__create_compat_230': Use memcached:// for legacy memcached. For config >>> cache, use LCB_CNTL_CONFIGCACHE [C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\deps\lcb\couchbase.vcxproj] >>> C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\deps\lcb\include\libcouchbase/deprecated.h(117) >>> : see declaration of 'lcb__create_compat_230' >>> newconfig.c >>> ..\..\..\deps\lcb\src\legacy.c(417): warning C4996: >>> 'lcb__create_compat_230': Use memcached:// for legacy memcached. For config >>> cache, use LCB_CNTL_CONFIGCACHE [C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\deps\lcb\couchbase.vcxproj] >>> C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\deps\lcb\include\libcouchbase/deprecated.h(117) >>> : see declaration of 'lcb__create_compat_230' >>> nodeinfo.c >>> iofactory.c >>> retryq.c >>> retrychk.c >>> settings.c >>> timings.c >>> utilities.c >>> wait.c >>> plugin-select.c >>> iocp_iops.c >>> iocp_loop.c >>> iocp_timer.c >>> iocp_util.c >>> couchbase.vcxproj -> C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\Release\\libcouchbase.lib >>> genhash.c >>> base64.c >>> url_encoding.c >>> gethrtime.c >>> hashtable.c >>> hashset.c >>> hostlist.c >>> list.c >>> logging.c >>> packetutils.c >>> ringbuffer.c >>> simplestring.c >>> couchbase_utils.vcxproj -> C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\Release\\libcouchbase_utils.lib >>> connect.c >>> ctx.c >>> ioutils.c >>> iotable.c >>> protoctx.c >>> manager.c >>> timer.c >>> lcbio.vcxproj -> C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\Release\\liblcbio.lib >>> snappy-c.cc >>> snappy-sinksource.cc >>> snappy-stubs-internal.cc >>> snappy.cc >>> c:\Program Files (x86)\Microsoft Visual Studio >>> 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used, >>> but unwind semantics are not enabled. Specify /EHsc [C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\deps\lcb\snappy.vcxproj] >>> c:\Program Files (x86)\Microsoft Visual Studio >>> 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used, >>> but unwind semantics are not enabled. Specify /EHsc [C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\deps\lcb\snappy.vcxproj] >>> c:\Program Files (x86)\Microsoft Visual Studio >>> 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used, >>> but unwind semantics are not enabled. Specify /EHsc [C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\deps\lcb\snappy.vcxproj] >>> ..\..\..\deps\lcb\contrib\snappy\snappy.cc(1014): warning C4018: '>=' : >>> signed/unsigned mismatch [C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\deps\lcb\snappy.vcxproj] >>> ..\..\..\deps\lcb\contrib\snappy\snappy.cc(1096): warning C4018: '>=' : >>> signed/unsigned mismatch [C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\deps\lcb\snappy.vcxproj] >>> snappy.vcxproj -> C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\Release\\libsnappy.lib >>> ketama.c >>> vbucket.c >>> vbucket.vcxproj -> C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\Release\\libvbucket.lib >>> couchbase_impl.cc >>> control.cc >>> constants.cc >>> transcoder.cc >>> binding.cc >>> operations.cc >>> ..\src\transcoder.cc(82): warning C4344: behavior change: use of >>> explicit template arguments results in call to 'v8::Local<T> >>> NanNew<v8::String,char*>(P,int)' [C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\couchbase_impl.vcxproj] >>> with >>> [ >>> T=v8::String, >>> P=char * >>> ] >>> but the regular function 'v8::Local<T> NanNew(const char >>> *,int)' is a better match >>> with >>> [ >>> T=v8::String >>> ] >>> if you expect 'v8::Local<T> NanNew(const char *,int)' to be >>> called then you need to make it an explicit specialization >>> with >>> [ >>> T=v8::String >>> ] >>> cas.cc >>> uv-plugin-all.c >>> Creating library C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\Release\couchbase_impl.lib and >>> object C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\Release\couchbase_impl.exp >>> Generating code >>> Finished generating code >>> couchbase_impl.vcxproj -> C:\Program Files >>> (x86)\nodejs\node_modules\couchbase\build\Release\\couchbase_impl.node >>> [email protected] ..\node_modules\couchbase >>> ├── [email protected] >>> ├── [email protected] >>> ├── [email protected] >>> └── [email protected] ([email protected], [email protected], >>> [email protected], [email protected], [email protected], >>> [email protected], [email protected], [email protected], [email protected], >>> [email protected], [email protected], [email protected], [email protected], >>> [email protected], [email protected]) >>> >>> >>> npm WARN unmet dependency C:\Program Files >>> (x86)\nodejs\node_modules\npm\node_mo >>> dules\couch-login requires request@'~2.9.202' but will load >>> npm WARN unmet dependency C:\Program Files >>> (x86)\nodejs\node_modules\npm\node_mo >>> dules\request, >>> npm WARN unmet dependency which is version 2.42.0 >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Couchbase" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >>> -- >>> Job board: http://jobs.nodejs.org/ >>> New group rules: >>> https://gist.github.com/othiym23/9886289#file-moderation-policy-md >>> Old group rules: >>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "nodejs" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/nodejs/54BDB19E.5040902%40gmail.com >>> <https://groups.google.com/d/msgid/nodejs/54BDB19E.5040902%40gmail.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> Job board: http://jobs.nodejs.org/ >> New group rules: >> https://gist.github.com/othiym23/9886289#file-moderation-policy-md >> Old group rules: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> --- >> You received this message because you are subscribed to the Google Groups >> "nodejs" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/nodejs/CAGjmZGzdPjCWV%3DJ-C-ZQ6G98%3DinZQr9RGWVjD_RG_pp%3DQLxxXA%40mail.gmail.com >> <https://groups.google.com/d/msgid/nodejs/CAGjmZGzdPjCWV%3DJ-C-ZQ6G98%3DinZQr9RGWVjD_RG_pp%3DQLxxXA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . > > >> For more options, visit https://groups.google.com/d/optout. >> > -- > Job board: http://jobs.nodejs.org/ > New group rules: > https://gist.github.com/othiym23/9886289#file-moderation-policy-md > Old group rules: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/nodejs/CAEr-_TdcXQuCgZNbJT9nzc6WPGMBTOG4XVZUaHRaazrdsYB6PQ%40mail.gmail.com > <https://groups.google.com/d/msgid/nodejs/CAEr-_TdcXQuCgZNbJT9nzc6WPGMBTOG4XVZUaHRaazrdsYB6PQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAGjmZGw1uKvSm_5qF-pkH7t11FWrGvw%3Dh6Xu77Hf-P7SBA72fA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
