Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

npm install fail #1784

Closed
birbird opened this issue Dec 18, 2018 · 4 comments
Closed

npm install fail #1784

birbird opened this issue Dec 18, 2018 · 4 comments

Comments

@birbird
Copy link

birbird commented Dec 18, 2018

[root@daniel ipfs-demo]# npm install ipfs

> [email protected] install /root/ipfs-demo/node_modules/gc-stats
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download 
[gc-stats] Success: "/root/ipfs-demo/node_modules/gc-stats/build/gcstats/v1.2.1/Release/node-v64-linux-x64/gcstats.node" is installed via remote

> [email protected] install /root/ipfs-demo/node_modules/tiny-secp256k1
> node-gyp rebuild

make: Entering directory `/root/ipfs-demo/node_modules/tiny-secp256k1/build'
  CXX(target) Release/obj.target/secp256k1/native/addon.o
In file included from ../native/addon.cpp:4:0:
../../nan/nan.h: In constructor ‘Nan::Utf8String::Utf8String(v8::Local<v8::Value>)’:
../../nan/nan.h:1081:101: error: no matching function for call to ‘v8::String::WriteUtf8(v8::Isolate*, char*&, int, int, const int&)’
         length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_, static_cast<int>(len), 0, flags);
                                                                                                     ^
../../nan/nan.h:1081:101: note: candidate is:
In file included from /root/.node-gyp/10.3.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:53,
                 from ../native/addon.cpp:4:
/root/.node-gyp/10.3.0/include/node/v8.h:2592:7: note: int v8::String::WriteUtf8(char*, int, int*, int) const
   int WriteUtf8(char* buffer,
       ^
/root/.node-gyp/10.3.0/include/node/v8.h:2592:7: note:   candidate expects 4 arguments, 5 provided
../native/addon.cpp: At global scope:
../native/addon.cpp:20:40: warning: missing initializer for member ‘std::array<unsigned char, 32ul>::_M_elems’ [-Wmissing-field-initializers]
  const std::array<uint8_t, 32> ZERO = {};
                                        ^
../native/addon.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE eccPrivateSub(Nan::NAN_METHOD_ARGS_TYPE)’:
../native/addon.cpp:239:53: warning: ignoring return value of ‘int secp256k1_ec_privkey_negate(const secp256k1_context*, unsigned char*)’, declared with attribute warn_unused_result [-Wunused-result]
  secp256k1_ec_privkey_negate(context, tweak_negated); // returns 1 always
                                                     ^
make: *** [Release/obj.target/secp256k1/native/addon.o] Error 1
make: Leaving directory `/root/ipfs-demo/node_modules/tiny-secp256k1/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.10.1-1.el7.elrepo.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/ipfs-demo/node_modules/tiny-secp256k1
gyp ERR! node -v v10.3.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-12-18T09_05_31_427Z-debug.log
[root@daniel ipfs-demo]# ll
total 44
-rwxrwx---   1 root vboxsf   400 Dec 17 07:04 index.js
drwxr-xr-x 576 root root   16384 Dec 18 04:05 node_modules
-rwxrwx---   1 root vboxsf   252 Dec 15 22:08 package.json
-rwxrwx---   1 root vboxsf   106 Dec 17 06:54 run.sh
[root@daniel ipfs-demo]# rm -rf node_modules/
[root@daniel ipfs-demo]# npm install ipfs
npm WARN deprecated [email protected]: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated [email protected]: ipfs-api has been renamed to ipfs-http-client, please update your package.json to get the latest version.
npm WARN deprecated [email protected]: This version is no longer maintained. Please upgrade to the latest version.

> [email protected] install /root/ipfs-demo/node_modules/gc-stats
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download 
[gc-stats] Success: "/root/ipfs-demo/node_modules/gc-stats/build/gcstats/v1.2.1/Release/node-v64-linux-x64/gcstats.node" is installed via remote

> [email protected] install /root/ipfs-demo/node_modules/keccak
> npm run rebuild || echo "Keccak bindings compilation fail. Pure JS implementation will be used."


> [email protected] rebuild /root/ipfs-demo/node_modules/keccak
> node-gyp rebuild

make: Entering directory `/root/ipfs-demo/node_modules/keccak/build'
  CXX(target) Release/obj.target/keccak/src/addon.o
In file included from ../src/addon.cc:2:0:
../../nan/nan.h: In constructor ‘Nan::Utf8String::Utf8String(v8::Local<v8::Value>)’:
../../nan/nan.h:1081:101: error: no matching function for call to ‘v8::String::WriteUtf8(v8::Isolate*, char*&, int, int, const int&)’
         length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_, static_cast<int>(len), 0, flags);
                                                                                                     ^
../../nan/nan.h:1081:101: note: candidate is:
In file included from /root/.node-gyp/10.3.0/include/node/node.h:63:0,
                 from ../src/addon.cc:1:
/root/.node-gyp/10.3.0/include/node/v8.h:2592:7: note: int v8::String::WriteUtf8(char*, int, int*, int) const
   int WriteUtf8(char* buffer,
       ^
/root/.node-gyp/10.3.0/include/node/v8.h:2592:7: note:   candidate expects 4 arguments, 5 provided
make: *** [Release/obj.target/keccak/src/addon.o] Error 1
make: Leaving directory `/root/ipfs-demo/node_modules/keccak/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.10.1-1.el7.elrepo.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/ipfs-demo/node_modules/keccak
gyp ERR! node -v v10.3.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-12-18T09_07_58_726Z-debug.log
Keccak bindings compilation fail. Pure JS implementation will be used.

> [email protected] install /root/ipfs-demo/node_modules/secp256k1
> npm run rebuild || echo "Secp256k1 bindings compilation fail. Pure JS implementation will be used."


> [email protected] rebuild /root/ipfs-demo/node_modules/secp256k1
> node-gyp rebuild

make: Entering directory `/root/ipfs-demo/node_modules/secp256k1/build'
  CXX(target) Release/obj.target/secp256k1/src/addon.o
In file included from ../src/addon.cc:2:0:
../../nan/nan.h: In constructor ‘Nan::Utf8String::Utf8String(v8::Local<v8::Value>)’:
../../nan/nan.h:1081:101: error: no matching function for call to ‘v8::String::WriteUtf8(v8::Isolate*, char*&, int, int, const int&)’
         length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_, static_cast<int>(len), 0, flags);
                                                                                                     ^
../../nan/nan.h:1081:101: note: candidate is:
In file included from /root/.node-gyp/10.3.0/include/node/node.h:63:0,
                 from ../src/addon.cc:1:
/root/.node-gyp/10.3.0/include/node/v8.h:2592:7: note: int v8::String::WriteUtf8(char*, int, int*, int) const
   int WriteUtf8(char* buffer,
       ^
/root/.node-gyp/10.3.0/include/node/v8.h:2592:7: note:   candidate expects 4 arguments, 5 provided
make: *** [Release/obj.target/secp256k1/src/addon.o] Error 1
make: Leaving directory `/root/ipfs-demo/node_modules/secp256k1/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.10.1-1.el7.elrepo.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/ipfs-demo/node_modules/secp256k1
gyp ERR! node -v v10.3.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-12-18T09_08_02_425Z-debug.log
Secp256k1 bindings compilation fail. Pure JS implementation will be used.

> [email protected] install /root/ipfs-demo/node_modules/tiny-secp256k1
> node-gyp rebuild

make: Entering directory `/root/ipfs-demo/node_modules/tiny-secp256k1/build'
  CXX(target) Release/obj.target/secp256k1/native/addon.o
In file included from ../native/addon.cpp:4:0:
../../nan/nan.h: In constructor ‘Nan::Utf8String::Utf8String(v8::Local<v8::Value>)’:
../../nan/nan.h:1081:101: error: no matching function for call to ‘v8::String::WriteUtf8(v8::Isolate*, char*&, int, int, const int&)’
         length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_, static_cast<int>(len), 0, flags);
                                                                                                     ^
../../nan/nan.h:1081:101: note: candidate is:
In file included from /root/.node-gyp/10.3.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:53,
                 from ../native/addon.cpp:4:
/root/.node-gyp/10.3.0/include/node/v8.h:2592:7: note: int v8::String::WriteUtf8(char*, int, int*, int) const
   int WriteUtf8(char* buffer,
       ^
/root/.node-gyp/10.3.0/include/node/v8.h:2592:7: note:   candidate expects 4 arguments, 5 provided
../native/addon.cpp: At global scope:
../native/addon.cpp:20:40: warning: missing initializer for member ‘std::array<unsigned char, 32ul>::_M_elems’ [-Wmissing-field-initializers]
  const std::array<uint8_t, 32> ZERO = {};
                                        ^
../native/addon.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE eccPrivateSub(Nan::NAN_METHOD_ARGS_TYPE)’:
../native/addon.cpp:239:53: warning: ignoring return value of ‘int secp256k1_ec_privkey_negate(const secp256k1_context*, unsigned char*)’, declared with attribute warn_unused_result [-Wunused-result]
  secp256k1_ec_privkey_negate(context, tweak_negated); // returns 1 always
                                                     ^
make: *** [Release/obj.target/secp256k1/native/addon.o] Error 1
make: Leaving directory `/root/ipfs-demo/node_modules/tiny-secp256k1/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.10.1-1.el7.elrepo.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/ipfs-demo/node_modules/tiny-secp256k1
gyp ERR! node -v v10.3.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-12-18T09_08_07_340Z-debug.log

My package.json and no package-lock.json

{
  "name": "ipfs-demo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "ipfs": "^0.33.1"
  }
}

Node 10.3.0 on CentOS 7.3

@alanshaw
Copy link
Member

alanshaw commented Jan 3, 2019

I get this same problem with 10.3.0, upgrading to 10.15.0 fixed the issue.

@alanshaw alanshaw closed this as completed Jan 3, 2019
@baruchvlz
Copy link

baruchvlz commented Feb 14, 2019

Not sure if related as I am getting a different error though it's caused by the same package tiny-secp256k1.

Node: 10.15
NPM: 6.4.1
OS: MacOS Mojave 10.14

error /path/to/project/node_modules/tiny-secp256k1: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /path/to/project/node_modules/tiny-secp256k1

Complete output: https://textuploader.com/15ags

@asutosh05
Copy link

asutosh05 commented Jul 16, 2019

node js 10.15.x is working for me.

@iameddieyayaya
Copy link

running into the same issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants