TryGhost / node-sqlite3

SQLite3 bindings for Node.js
BSD 3-Clause "New" or "Revised" License
6.23k stars 816 forks source link

Cant install on Ubuntu 14.04 #529

Closed rsolci closed 9 years ago

rsolci commented 9 years ago

Hi, im trying to install sqlite3 by npm install sqlite3 and i keep getting this error

https://gist.github.com/rsolci/1237ff48f2add3615249

I tried as root but after seeing some comments i switched to a normal user, got the same error

Thanks in advance

dziamid commented 9 years ago

npm install sqlite3 works, seems that this repo has been moved to sqlite3 npm package

rsolci commented 9 years ago

well i issued the same npm install sqlite3and i got the error i pasted, anyone got a clue about what is the problem?

zedtux commented 9 years ago

I have the same error when installing Ghost blogging platform.

Here is the part of the build logs:

npm info install sqlite3@3.0.8

> sqlite3@3.0.8 install /ghost/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.7
node-pre-gyp info using node@4.2.1 | linux | x64
node-pre-gyp info check checked for "/ghost/node_modules/sqlite3/lib/binding/node-v46-linux-x64/node_sqlite3.node" (not found)
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.0.8/node-v46-linux-x64.tar.gz
node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.0.8/node-v46-linux-x64.tar.gz
node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.0.8/node-v46-linux-x64.tar.gz (falling back to source compile with node-gyp) 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.0.3
gyp info using node@4.2.1 | linux | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.0.3
gyp info using node@4.2.1 | linux | x64
gyp http GET https://nodejs.org/download/release/v4.2.1/node-v4.2.1-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v4.2.1/node-v4.2.1-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v4.2.1/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v4.2.1/SHASUMS256.txt
gyp info spawn python2
gyp info spawn args [ '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/ghost/node_modules/sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.node-gyp/4.2.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/4.2.1',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=/ghost/node_modules/sqlite3',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.0.3
gyp info using node@4.2.1 | linux | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/ghost/node_modules/sqlite3/build'
  ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3080900/sqlite3.c
  TOUCH Release/obj.target/deps/action_before_build.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3080900/sqlite3.o
  AR(target) Release/obj.target/deps/sqlite3.a
  COPY Release/sqlite3.a
  CXX(target) Release/obj.target/node_sqlite3/src/database.o
In file included from ../src/database.h:11:0,
                 from ../src/database.cc:5:
../node_modules/nan/nan.h:261:25: error: redefinition of 'template<class T> v8::Local<T> _NanEnsureLocal(v8::Local<T>)'
 NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
                         ^
../node_modules/nan/nan.h:256:25: note: 'template<class T> v8::Local<T> _NanEnsureLocal(v8::Handle<T>)' previously declared here
 NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {
                         ^
../node_modules/nan/nan.h:661:13: error: 'node::smalloc' has not been declared
     , node::smalloc::FreeCallback callback
             ^
../node_modules/nan/nan.h:661:35: error: expected ',' or '...' before 'callback'
     , node::smalloc::FreeCallback callback
                                   ^
../node_modules/nan/nan.h: In function 'v8::Local<v8::Object> NanNewBufferHandle(char*, size_t, int)':
../node_modules/nan/nan.h:665:50: error: 'callback' was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                  ^
../node_modules/nan/nan.h:665:60: error: 'hint' was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                            ^
../node_modules/nan/nan.h: In function 'v8::Local<v8::Object> NanNewBufferHandle(const char*, uint32_t)':
../node_modules/nan/nan.h:672:67: error: call of overloaded 'New(v8::Isolate*, const char*&, uint32_t&)' is ambiguous
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
../node_modules/nan/nan.h:672:67: note: candidates are:
In file included from ../node_modules/nan/nan.h:25:0,
                 from ../src/database.h:11,
                 from ../src/database.cc:5:
/root/.node-gyp/4.2.1/include/node/node_buffer.h:31:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding) <near match>
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/root/.node-gyp/4.2.1/include/node/node_buffer.h:31:40: note:   no known conversion for argument 3 from 'uint32_t {aka unsigned int}' to 'node::encoding'
/root/.node-gyp/4.2.1/include/node/node_buffer.h:43:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t) <near match>
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/root/.node-gyp/4.2.1/include/node/node_buffer.h:43:40: note:   no known conversion for argument 2 from 'const char*' to 'char*'
In file included from ../src/database.h:11:0,
                 from ../src/database.cc:5:
../node_modules/nan/nan.h: In function 'v8::Local<v8::Object> NanNewBufferHandle(uint32_t)':
../node_modules/nan/nan.h:676:61: error: could not convert 'node::Buffer::New(v8::Isolate::GetCurrent(), ((size_t)size))' from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>'
     return node::Buffer::New(v8::Isolate::GetCurrent(), size);
                                                             ^
../node_modules/nan/nan.h: In function 'v8::Local<v8::Object> NanBufferUse(char*, uint32_t)':
../node_modules/nan/nan.h:683:12: error: 'Use' is not a member of 'node::Buffer'
     return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
            ^
../src/database.cc: In static member function 'static void node_sqlite3::Database::Work_BeginOpen(node_sqlite3::Database::Baton*)':
../src/database.cc:145:9: warning: unused variable 'status' [-Wunused-variable]
     int status = uv_queue_work(uv_default_loop(),
         ^
../src/database.cc: In static member function 'static void node_sqlite3::Database::Work_BeginClose(node_sqlite3::Database::Baton*)':
../src/database.cc:230:9: warning: unused variable 'status' [-Wunused-variable]
     int status = uv_queue_work(uv_default_loop(),
         ^
../src/database.cc: In static member function 'static void node_sqlite3::Database::Work_BeginExec(node_sqlite3::Database::Baton*)':
../src/database.cc:509:9: warning: unused variable 'status' [-Wunused-variable]
     int status = uv_queue_work(uv_default_loop(),
         ^
../src/database.cc: In static member function 'static void node_sqlite3::Database::Work_BeginLoadExtension(node_sqlite3::Database::Baton*)':
../src/database.cc:610:9: warning: unused variable 'status' [-Wunused-variable]
     int status = uv_queue_work(uv_default_loop(),
         ^
node_sqlite3.target.mk:106: recipe for target 'Release/obj.target/node_sqlite3/src/database.o' failed
make: Leaving directory '/ghost/node_modules/sqlite3/build'
make: *** [Release/obj.target/node_sqlite3/src/database.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:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.2.0-1-amd64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/ghost/node_modules/sqlite3/lib/binding/node-v46-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/ghost/node_modules/sqlite3/lib/binding/node-v46-linux-x64"
gyp ERR! cwd /ghost/node_modules/sqlite3
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/ghost/node_modules/sqlite3/lib/binding/node-v46-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/ghost/node_modules/sqlite3/lib/binding/node-v46-linux-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/ghost/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:818:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Linux 4.2.0-1-amd64
node-pre-gyp ERR! command "/usr/local/bin/node" "/ghost/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /ghost/node_modules/sqlite3
node-pre-gyp ERR! node -v v4.2.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.7
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/ghost/node_modules/sqlite3/lib/binding/node-v46-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/ghost/node_modules/sqlite3/lib/binding/node-v46-linux-x64' (1)
talkingtab commented 9 years ago

Tried a clean install without using ghost

mkdir foo cd foo npm install sqlite3 ---- this failed with 4.2.1, 5.0 and v0.12 sudo npm install sqlite3 was successful. I did not look at why.

Linux 3.2.0-24-virtual #37-Ubuntu SMP Wed Apr 25 12:51:49 UTC 2012 i686 i686 i386 GNU/Linux

springmeyer commented 9 years ago

The problem everyone here is facing can be solved by installing sqlite3@3.1.x. From the logs it looks like you all are installing sqlite3@3.0.8 which does not support Node 4.x.

zedtux commented 9 years ago

Thank you @springmeyer ! I have downgraded to node 0.12.x and now Ghost is installing successfully !

ErisDS commented 9 years ago

As mentioned sqlite@3.0.8, and therefore Ghost do not support Node 4.0 or above. If you're running into this issue because of Ghost, please downgrade to 0.12 or 0.10.

You can find information about Ghost moving towards support for new versions of node here: https://github.com/TryGhost/Ghost/issues/5821.