ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.43k stars 1.25k forks source link

npm install ipfs --save failed #1769

Closed waliguder closed 5 years ago

waliguder commented 5 years ago

image

This is my installation environment: image

achingbrain commented 5 years ago

It's failing to install tiny-secp256k1 with an ECONNRESET error which usually indicates a network problem

Can you install that module successfully on it's own? Eg:

$ npm i tiny-secp256k1

Also, you're installing ipfs as root - npm usually drops to an unprivileged user to run package scripts which can mess up installing modules that need to compile native code (such as tiny-secp256k1).

Either don't install as root (preferable) or use the --unsafe-perm flag (definitely not preferable).

alanshaw commented 5 years ago

ping @waliguder did that resolve your issue?

rossbulat commented 5 years ago

Hi @alanshaw. It does not.

I am having the same issue installing on macOS.

Attempting (with and without --unsafe-perm flag): yarn add tiny-secp256k1 gets the following output:

error /www/sites/rossbulat/client/node_modules/tiny-secp256k1: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /www/sites/rossbulat/client/node_modules/tiny-secp256k1
Output:
module.js:550
    throw err;
    ^

Error: Cannot find module 'graceful-fs'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:12:10)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
Warning: Pattern ["graceful-fs@^4.1.15"] is trying to unpack in the same destination... (skipping)

Furthermore, running npm i tiny-secp256k1 outputs:

module.js:550
    throw err;
    ^
Error: Cannot find module '../lib/utils/unsupported.js'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:153:3)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)

Node version: v8.12.0 yarn version: v1.12.3

junderw commented 5 years ago

https://github.com/bitcoinjs/tiny-secp256k1/issues/32#issuecomment-450545493

Try the method I gave here.

rossbulat commented 5 years ago

Reinstalling node resolved the error.

sudo rm -rf /usr/local/lib/node_modules/npm
brew reinstall node