Установить couchnode(клиент couchbase nodejs) с ошибкой компиляции на osx

После установки libcouchbase я извинился

sudo npm install couchbase

Сообщается об ошибке:

npm WARN cannot run in wd couchbase@1.2.4 (node-gyp rebuild 2> builderror.log) || (exit 0) (wd=/Users/mymac/node_modules/couchbase)

затем я пошел в node_modules/couchbase и выполнил

npm install

Он вывел ошибку журнала:

../deps/lcb/src/compat.c:194:36: warning: missing field 'v' initializer [-Wmissing-field-initializers]
    struct lcb_create_st cst = { 0 };
                                   ^
1 warning generated.
../src/logger.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
../src/logger.h:74:   instantiated from here
../src/logger.h:74: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
../src/logger.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
../src/logger.h:74:   instantiated from here
../src/logger.h:74: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
../src/logger.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
../src/logger.h:74:   instantiated from here
../src/logger.h:74: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
../src/logger.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
../src/logger.h:74:   instantiated from here
../src/logger.h:74: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
make: *** [Release/obj.target/couchbase_impl/src/couchbase_impl.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:807:12)
gyp ERR! System Darwin 12.5.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/couchbase
gyp ERR! node -v v0.10.28
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok 

Похоже, что node-gyp не может правильно скомпилировать исходный код

если я использую код

 var couchbase = require('couchbase');
 var db = new couchbase.Connection({
     bucket: "default"

 },
 function(err) {
     if (err) throw err;
     db.set('testdoc1', {
         name: 'Frank1'
     }, function(err, result) {
         if (err) throw err;
         db.get('testdoc1', function(err, result) {
             if (err) throw err;
             console.log(result.value);
             // {name: Frank}
         });
     });
 });

консольные отчеты

Users/mymac/node_modules/couchbase/lib/binding.js:17
      throw e;
            ^
Error: dlopen(/Users/mymac/node_modules/couchbase/prebuilt/win/x64/couchbase_impl.node, 1): no suitable image found.  Did find:
    /Users/mymac/node_modules/couchbase/prebuilt/win/x64/couchbase_impl.node: unknown file type, first eight bytes: 0x4D 0x5A 0x90 0x00 0x03 0x00 0x00 0x00
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at bindings (/Users/mymac/node_modules/couchbase/node_modules/bindings/bindings.js:74:15)
    at tryLoadBinding (/Users/mymac/node_modules/couchbase/lib/binding.js:13:31)
    at Object.<anonymous> (/Users/mymac/node_modules/couchbase/lib/binding.js:31:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

он не может узнать правильный couchbase_impl.node (там ничего нет)

так что это идет к предварительной сборке и получить неправильную версию платформы

/Users/mymac/node_modules/couchbase/prebuilt/win/x64/couchbase_impl.node

Я пытаюсь установить couchnode на Centos, Ubuntu, даже 1 год назад на OSX же Mac без каких-либо проблем.

Я не уверен, изменил ли я что-то / конфигурацию, такую ​​как gcc для clang, когда сделал другую работу, это влияет на это?

Я старался

export CC=gcc
export CXX=gcc
export CXXFLAGS=-mmacosx-version-min=10.8

или же

export CC=clang
export CXX=clang
export CXXFLAGS=-mmacosx-version-min=10.8

и переустановите couchnode, но никто не работал

Ваш комментарий приветствуется

1 ответ

Была связанная ошибка: "Ошибка: dlopen([...]/app/node_modules/couchbase/prebuilt/win/x64/couchbase_impl.node, 1): подходящее изображение не найдено"

Мне удалось решить это на OS X 10.9.5 с xcode 6.0.1

Установите свежую копию libcouchbase:

$ brew install libcouchbase

Это установит libcouchbase в /usr/local/Cellar/libcouchbase/2.4.1 (или какая-либо версия является текущей). Далее установите Node-SDK через npm

$ npm install --couchbase-root=/usr/local/Cellar/libcouchbase/2.4.1 couchbase

похоже, что вам нужно объявить --couchbase-root= при установке в OS X

Другие вопросы по тегам