ipfs / js-ipfs

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

node-gyp instructions for linux install needs added to readme #619

Closed SidHarder closed 7 years ago

SidHarder commented 7 years ago

We need to add the node-gyp installation instructions as requirement for install of js-ipfs on linux systems.

victorb commented 7 years ago

AFAIK, node-gyp should come bundled with npm and not require explicit installation, as long as you have npm

https://github.com/nodejs/node-gyp/wiki/Updating-npm's-bundled-node-gyp

npm bundles its own, internal, copy of node-gyp. This internal copy is independent of any globally installed copy of node-gyp that you may have installed via npm install -g node-gyp.

This means that while node-gyp doesn't get installed into your $PATH by default, npm still keeps its own copy to invoke when you attempt to npm install a native addon.

daviddias commented 7 years ago

exactly what @VictorBjelkholm referenced. How did you install node, @SidHarder ?

daviddias commented 7 years ago

@SidHarder do you find this to still be a problem?

daviddias commented 7 years ago

Closing, let us know if the problem persists (should not be the case)

devingfx commented 7 years ago

Hello,

I've got trouble installing js-ipfs, some dependencies can't compile I've got make errors... After investigation, I figured out my node-gyp is v3.5.0 and my node is v6.0.0 is this normal ? (I'm node expert with npm and gyp so I assume that it have to be in the same version number no?)

I'm on ubuntu 14, I installed/switched to node v6 using n, I updated npm with npm install npm@latest -g

errors:

make: *** [Release/obj.target/fs-ext/fs-ext.o] Error 1
make: Leaving directory '/home/zephilde/Downloads/dev/Quantum/node_modules/fs-ext/build'
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:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Linux 3.8.11
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/zephilde/Downloads/dev/Quantum/node_modules/fs-ext
gyp ERR! node -v v6.0.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok 
make: *** [Release/obj.target/sha3/src/addon.o] Error 1
make: Leaving directory `'home/zephilde/Downloads/dev/Quantum/node_modules/sha3/build'
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:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Linux 3.8.11
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 /home/zephilde/Downloads/dev/Quantum/node_modules/sha3
gyp ERR! node -v v6.0.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN quantum@0.1.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs-ext@0.6.0 (node_modules/fs-ext):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs-ext@0.6.0 install: `node-gyp configure build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sha3@1.2.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sha3@1.2.0 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 sha3 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 sha3
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls sha3
npm ERR! There is likely additional logging output above.
daviddias commented 7 years ago

@devingfx it is weird that it fails specifically at sha3 for you, can you check you have all your OS packages up to date as well?

The normal error is with the wrtc package, which requires all of this deps -- listed here: https://www.npmjs.com/package/wrtc#debianubuntu --.

@VictorBjelkholm this is a recurring question, since you are the most save installing in Ubuntu, could you compile a list of checks for users to follow?

SidHarder commented 7 years ago

@devingfx I had this problem a few months ago and spent several hours trying to solve it. As I remember the problem had to do with node-gyp and python. After I got node-gyp and the correct version of python installed things started working.

devingfx commented 7 years ago

I did upgrade the most I could... nothing... I couldn't even install the libs from your link @diasdavid (wrtc) :

sudo apt-get install python2.7 git-all pkg-config libncurses5-dev libssl-dev libnss3-dev libexpat-dev

I get :

Setting up liblwp-protocol-https-perl (6.02-1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
 runit
 git-daemon-run
E: Sub-process /usr/bin/dpkg returned an error code (1)

I abandon... I'll test on a better config, as I'm on a chrooted ubuntu in parallel with a chromeOS in dev mode, not the better place to test ipfs !

Thank still for your help!

pyromaticx commented 7 years ago

@devingfx Im getting the same errors after running

sudo apt-get install python2.7 git-all pkg-config libncurses5-dev libssl-dev libnss3-dev libexpat-dev

Installing wrtc globally fixed this for me on linux, but its more of a quick fix than anything else. I am having this issue on osx as well as ubuntu 16

ghost commented 7 years ago

You don't need git-all btw. I got js-ipfs working just a few minutes ago with a git clean -fdx, after installing the wrtc dependencies and installing node v6.

yaananth commented 7 years ago

On windows10,

https://github.com/phusion/node-sha3/issues/27

After clearing that, I got:

MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framew
ork 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it i
s installed elsewhere.  

So I eventually ended up doing this (or I could select the component from VS 2017)

# as admin
npm install --global --production windows-build-tools

But now one of the dependencies failed with:

if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure build )  else (node "" configure build )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  fs-ext.cc
  win_delay_load_hook.cc
..\fs-ext.cc(192): error C3861: 'uv_get_osfhandle': identifier not found [...s\node_modules\fs-ext\b
uild\fs-ext.vcxproj]
..\fs-ext.cc(287): error C3861: 'uv_get_osfhandle': identifier not found [...s\node_modules\fs-ext\b
uild\fs-ext.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "build"

Looks like it's optional? When do we actually need it? https://github.com/baudehlo/node-fs-ext/issues/57

I still have to test if everything works as expected...

daviddias commented 7 years ago

It is used in ipfs-repo to lock the repo:

Before we were locking the repo with just a File, but now we are doing the same the go-ipfs is doing. @dignifiedquire applied this change, he will be able to share a bit more behind the decision there.