node-gyp rebuild error in ubuntu

Created on 10 Oct 2016  ·  5Comments  ·  Source: nodejs/node-gyp

I try to install truffle by sudo npm install -g truffle and get error

gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/hzxscyq/.node-gyp/6.7.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/truffle/node_modules/scrypt/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: read ECONNRESET
gyp ERR! stack     at exports._errnoException (util.js:1036:11)
gyp ERR! stack     at TLSWrap.onread (net.js:564:26)
gyp ERR! System Linux 4.4.0-31-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/truffle/node_modules/scrypt
gyp ERR! node -v v6.7.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 
/usr/local/lib
└── (empty)

npm WARN optional Skipping failed optional dependency /truffle/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm ERR! Linux 4.4.0-31-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "truffle"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the scrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs scrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls scrypt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/hzxscyq/npm-debug.log
npm ERR! code 1

how can i solve the problem?

All 5 comments

I suspect node-gyp can't download the SDK from nodejs.org, possibly because something in your network is blocking the outgoing connection. Can you try again with --verbose and post the full output?

I install truffle use cnpm command
but the output of truffle version is

fs.js:640
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open '/usr/local/lib/node_modules/.truffle_npminstall/node_modules/.1.0.1@arr-flatten/index.js'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.readFileSync (fs.js:508:33)
    at Module._extensions..js (module.js:564:20)
    at Object.require.extensions.(anonymous function) [as .js] (/usr/local/lib/node_modules/.truffle_npminstall/node_modules/.6.16.3@babel-register/lib/node.js:152:7)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/.truffle_npminstall/node_modules/.2.0.0@arr-diff/index.js:10:15)
    at Module._compile (module.js:556:32)
    at Module._extensions..js (module.js:565:10)
    at Object.require.extensions.(anonymous function) [as .js] (/usr/local/lib/node_modules/.truffle_npminstall/node_modules/.6.16.3@babel-register/lib/node.js:152:7)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)

and the output of sudo truffle version is
Truffle v2.0.8
do I install truffle correctly?

I don't know. You should take that up with the truffle maintainers.

I had the same problem (read ECONNRESET) trying to install truffle. However, I was able to install node-gyp (global) and then install truffle.

The error seems to originate from a scrypt post install script or maybe a crypto module of it, used by secp256k1. I once saw the following error:

npm ERR! Linux 4.4.0-31-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "rebuild"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! [email protected] rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] rebuild script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the secp256k1 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs secp256k1

Running on Ubuntu 16.04

Closing, answered.

Was this page helpful?
0 / 5 - 0 ratings