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

Installation Fails on Ubuntu with tunneling socket could not be established #705

Closed
DVG opened this issue Feb 25, 2015 · 16 comments
Closed

Comments

@DVG
Copy link

DVG commented Feb 25, 2015

When running npm install node-sass@2.0.1 --save-dev. it fails with the following error:

npm info install node-sass@2.0.1
> node-sass@2.0.1 install /home/me/code/projects/myproject/node_modules/node-sass
> node scripts/install.js
tunneling socket could not be established, cause=140168125925184:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:795:
npm verb unsafe-perm in lifecycle true
npm info postinstall node-sass@2.0.1
> node-sass@2.0.1 postinstall /home/me/code/projects/myproject/node_modules/node-sass
> node scripts/build.js
module.js:340
    throw err;
          ^
Error: Cannot find module '/home/me/code/projects/myproject/node_modules/node-sass/node_modules/pangyp/bin/node-gyp'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:929:3
Build failed

We are behind a proxy, but this is the only NPM package I've encountered that won't install with our configuration/

I've gotten a few older versions to install with a precompiled binary, but it still can't seem to find the libsass bindings and recommends reinstalling node-sass.

npm info install node-sass@1.1.4
> node-sass@1.1.4 install /home/o572014/code/projects/rsam-ember-cli-app-template/node_modules/node-sass
> node build.js
`linux-x64-v8-3.14` exists; testing
Binary is fine; exiting
$ ember s
ember s --port 4300
version: 0.1.15
`libsass` bindings not found. Try reinstalling `node-sass`?
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
    at getBinding (/home/me/code/projects/myproject/node_modules/ember-cli-sass/node_modules/broccoli-sass/node_modules/node-sass/lib/index.js:22:11)
    at Object.<anonymous> (/home/me/code/projects/myproject/node_modules/ember-cli-sass/node_modules/broccoli-sass/node_modules/node-sass/lib/index.js:188:23)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/me/code/projects/myproject/node_modules/ember-cli-sass/node_modules/broccoli-sass/index.js:5:12)
    at Module._compile (module.js:456:26)
@am11
Copy link
Contributor

am11 commented Feb 25, 2015

Tunneling error is back from the brink: #588.

//cc @xzyfer

@am11
Copy link
Contributor

am11 commented Feb 25, 2015

@DVG, please show the output of:

# you may need to prefix these with `sudo`:
$ mkdir /temp; cd /temp

$ npm install npmconf
$ node

then:

// This is node.js REPL
// The following code is extracted from node-sass/scripts/install.js#applyProxy
// just copy/paste the whole thing in shell at once
require('npmconf').load({}, function (er, conf) { 
  var options = {};
  var proxyUrl;

  if (!er) {
    proxyUrl = conf.get('https-proxy') ||
               conf.get('proxy') ||
               conf.get('http-proxy');
  }

  var env = process.env;

  options.proxy = proxyUrl ||
                  env.HTTPS_PROXY ||
                  env.https_proxy ||
                  env.HTTP_PROXY ||
                  env.http_proxy;

  console.log(options); 
}); 

after exiting the REPL:

# final cleanup
rm -r /temp

@xzyfer
Copy link
Contributor

xzyfer commented Feb 26, 2015

@DVG could you also supply a gist with the output of the following two commands

npm config list

and

env

@DVG
Copy link
Author

DVG commented Feb 26, 2015

@DVG
Copy link
Author

DVG commented Feb 26, 2015

The result of your script is:
undefined

{ proxy: 'https://proxy.mycompany.net:8000' }

@am11
Copy link
Contributor

am11 commented Feb 26, 2015

{ proxy: 'https://proxy.mycompany.net:8000' } should do the trick!
Does this help: http://stackoverflow.com/a/26054219/863980?

@DVG
Copy link
Author

DVG commented Feb 26, 2015

So I've done some experimenting on a fork, and I can get past the tunneling socket problem, however, the build.js script still fails on the node-gyp bit:

npm info install node-sass@2.0.1
> node-sass@2.0.1 install /home/me/code/projects/testapp/node_modules/node-sass
> node scripts/install.js
npm verb unsafe-perm in lifecycle true
npm info postinstall node-sass@2.0.1
> node-sass@2.0.1 postinstall /home/me/code/projects/testapp/node_modules/node-sass
> node scripts/build.js
Building: /home/me/.nvm/v0.10.36/bin/node node_modules/pangyp/bin/node-gyp rebuild
module.js:340
    throw err;
          ^
Error: Cannot find module '/home/me/code/projects/testapp/node_modules/node-sass/node_modules/pangyp/bin/node-gyp'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:929:3
Build failed

@DVG
Copy link
Author

DVG commented Feb 26, 2015

For the record, the tunneling socket seemed sensitive to the trailing slash I had in my NPM config, which was the only difference between the NPM config and the shell-level HTTPS_PROXY variable. I don't really know if that sort of thing is something you even care about, but since it doesn't seem to matter for the average NPM package I wanted to mention it.

@DVG
Copy link
Author

DVG commented Feb 26, 2015

I was able to install node-sass 1.1.4 with the proxy fix. I'm still unable to install the 2.0 line with the issues above, so I'm happy to keep helping figure out what's going on there.

@am11
Copy link
Contributor

am11 commented Feb 26, 2015

@DVG, excellent findings and glad to know that proxy issue is sorted out. 👍

Note that not all npm packages download binary in the installation step. However, since node-sass relies on a native binary, which is downloaded after the package itself is installed (hint: npm tasks).

I am not sure if the trailing slash is something unnecessary in all proxy servers scenarios? If they all defy then it is the issue when npm config are set and should be reported to https://github.com/npm/npm/issues.

The node-gyp step should not be triggered in first place for Ubuntu, since we are offering pre-build binary for Linux. To help us diagnose the issue, please make a gist showing the output of this set of commands: https://gist.github.com/am11/e5de3c49c219f0811e1d#comment-1386582.

@DVG
Copy link
Author

DVG commented Feb 26, 2015

@am11
Copy link
Contributor

am11 commented Feb 26, 2015

@DVG, actually we have recently change the naming convention and it seems like you are installing node-sass from fork? Can you try installing it from the npm install node-sass from the server instead (with and without --save-dev)?

# tunneling issue was sorted out,
# now lets try a clean install:
sudo mkdir /temp
cd /temp
npm install node-sass

# success!
node -p "console.log(require('node-sass').renderSync({data:'a{b:c}'}))"
# some CSS output!

# cleanup
cd ~/
sudo rm -rf /temp

Also for the forked installation, try these steps:

git clone https://github.com/dvg/nodess --recursive
cd node-sass
git remote add node-sass https://github.com/sass/node-sass
git pull --rebase node-sass master
git submodule --recursive --init
npm install

# the next one requires gcc/g++ v4.6+ and python 2.7.x
node scripts/build -f

# success!
node -p "console.log(require('./').renderSync({data:'a{b:c}'}))"
# ./ because you are in the node-sass directory

@DVG
Copy link
Author

DVG commented Feb 27, 2015

From a fork? I don't think so. I did temporarily to experiment with the proxy code upstream (which is how I spotted the trailing slash thing), but since then have been only trying to install the official package

In any case:

npm install node-sass
npm info install node-sass@2.0.1
> node-sass@2.0.1 install /home/me/temp/node_modules/node-sass
> node scripts/install.js
npm verb unsafe-perm in lifecycle true
npm info postinstall node-sass@2.0.1
> node-sass@2.0.1 postinstall /home/me/temp/node_modules/node-sass
> node scripts/build.js
Building: /home/me/.nvm/v0.10.36/bin/node node_modules/pangyp/bin/node-gyp rebuild
module.js:340
    throw err;
          ^
Error: Cannot find module '/home/me/temp/node_modules/node-sass/node_modules/pangyp/bin/node-gyp'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:929:3
Build failed 

$ node -p "console.log(require('node-sass').renderSync({data:'a{b:c}'}))"
/home/me/temp/node_modules/node-sass/lib/index.js:23
    throw new Error('`libsass` bindings not found. Try reinstalling `node-sass
          ^
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
    at getBinding (/home/me/temp/node_modules/node-sass/lib/index.js:23:11)
    at Object.<anonymous> (/home/me/temp/node_modules/node-sass/lib/index.js:197:23)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at [eval]:1:13
    at Object.<anonymous> ([eval]-wrapper:6:22)
npm install node-sass --save-dev
npm info install node-sass@2.0.1
> node-sass@2.0.1 install /home/me/temp/node_modules/node-sass
> node scripts/install.js
npm verb unsafe-perm in lifecycle true
npm info postinstall node-sass@2.0.1
> node-sass@2.0.1 postinstall /home/me/temp/node_modules/node-sass
> node scripts/build.js
Building: /home/me/.nvm/v0.10.36/bin/node node_modules/pangyp/bin/node-gyp rebuild
module.js:340
    throw err;
          ^
Error: Cannot find module '/home/me/temp/node_modules/node-sass/node_modules/pangyp/bin/node-gyp'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:929:3
Build failed

$ node -p "console.log(require('node-sass').renderSync({data:'a{b:c}'}))"
/home/me/temp/node_modules/node-sass/lib/index.js:23
    throw new Error('`libsass` bindings not found. Try reinstalling `node-sass
          ^
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
    at getBinding (/home/me/temp/node_modules/node-sass/lib/index.js:23:11)
    at Object.<anonymous> (/home/me/temp/node_modules/node-sass/lib/index.js:197:23)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at [eval]:1:13
    at Object.<anonymous> ([eval]-wrapper:6:22)

@am11
Copy link
Contributor

am11 commented Feb 27, 2015

Ah! you mentioned you were experimenting with fork, I thought the latter error is coming from there.

The fact that pangyp is not available is because I made a big blunder by adding it under dev-dependencies as opposed to main dependencies. However, I have remedied it via this PR some 15 minutes ago: #717. :)

But the most important thing is; it should NOT fallback to manual build step at all (where it requires pangyp), especially on Linux, Mac and Windows. It seems like either the binary is not successfully downloaded (for some network who-knows-what issue) OR it is not compatible with glibc; the latter one is very troubling because I tested all binaries on Ubuntu which I built on old CentOS (for backward compatibility) before releasing (and it is a big hassle!):

vagrant@precise64:/temp/test-install$ uname -r
3.11.0-15-generic

vagrant@precise64:/temp/test-install$ cat /etc/issue
Ubuntu 12.04.5 LTS \n \l

I have checked your logs again. You can try this approach:

cd into/myFav/project/dir
wget https://github.com/sass/node-sass/archive/v2.0.1.tar.gz
tar zxvf v2.0.1.tar.gz
cd node-sass
npm install
# should not try to invoke manual build! but we can just hope..

node -p "console.log(require('./').renderSync({data:'a{b:c}'}))"
# unsuccessful! :(

rm -rf vendor/lin*
mkdir vendor/linux-x64-node-0.10
wget https://github.com/sass/node-sass-binaries/blob/v2.0.1/linux-x64-node-0.10/binding.node vendor/linux-x64-node-0.10

node -p "console.log(require('./').renderSync({data:'a{b:c}'}))"
# success! :)

@yamalight
Copy link

have exactly same issue with iojs 1.4.x (from nvm) on macos 10.10.2.

npm i node-sass
-
> node-sass@2.0.1 install /Users/yamalight/Projects/muse/front-end/node_modules/node-sass
> node scripts/install.js

Can not download file from https://raw.githubusercontent.com/sass/node-sass-binaries/v2.0.1/darwin-x64-iojs-1.4/binding.node

> node-sass@2.0.1 postinstall /Users/yamalight/Projects/muse/front-end/node_modules/node-sass
> node scripts/build.js

module.js:322
    throw err;
          ^
Error: Cannot find module '/Users/yamalight/Projects/muse/front-end/node_modules/node-sass/node_modules/pangyp/bin/node-gyp'
    at Function.Module._resolveFilename (module.js:320:15)
    at Function.Module._load (module.js:262:25)
    at Function.Module.runMain (module.js:485:10)
    at startup (node.js:112:16)
    at node.js:863:3
Build failed

I assume because of the absence of the compiled binaries? When is the pangyp fixing PR getting pushed to NPM? :)

@am11
Copy link
Contributor

am11 commented Mar 3, 2015

have exactly same issue with iojs 1.4.x (from nvm) on macos 10.10.2.

No. The issue is that you cannot download binary for io.js 1.4, because node-sass v2.0.1 does not support io.js v1.4 but only io.js v1.2. The OP was having issue with https-proxy, which was fixed.

This issue was fixed by the OP. For separate issues, please search the issue tracker and if there is no issue reported as yours, feel free to report one.

@am11 am11 closed this as completed Mar 3, 2015
@am11 am11 added the Mitigated label Mar 3, 2015
jiongle1 pushed a commit to scantist-ossops-m2/node-sass that referenced this issue Apr 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants