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

Installing on io.js 1.2 on Windows 8.1 attempts to download sass binary for node 1.3 #708

Closed
F21 opened this issue Feb 26, 2015 · 7 comments

Comments

@F21
Copy link

F21 commented Feb 26, 2015

I am using io.js 1.2 64-bit on Windows 8.1 64-bit.

Npm is version 2.6.0.

I am attempting to install node-sass 2.0.1 and it is attempting to download the binary for node 1.3 which does not exist:

> node-sass@2.0.1 install D:\test\node_modules\gulp-sass\node_modules\node-sass
> node scripts/install.js

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

> node-sass@2.0.1 postinstall D:\test\node_modules\gulp-sass\node_modules\node-sass
> node scripts/build.js

module.js:324
    throw err;
          ^
Error: Cannot find module 'D:\test\node_modules\gulp-sass\node_modules\node-sass\node_modules\pangyp\bin\node-gyp'
    at Function.Module._resolveFilename (module.js:322:15)
    at Function.Module._load (module.js:264:25)
    at Function.Module.runMain (module.js:487:10)
    at startup (node.js:111:16)
    at node.js:799:3
Build failed
@F21
Copy link
Author

F21 commented Feb 26, 2015

If I manually download the binary and place it in to the vendors folder, I get:

[17:49:49] Error: %1 is not a valid Win32 application.
D:\test\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-x64-node-1.2\binding.node
    at Error (native)
    at Module.load (module.js:341:32)
    at Function.Module._load (module.js:296:12)
    at Module.require (module.js:351:17)
    at require (module.js:370:17)
    at Object.<anonymous> (D:\test\node_modules\gulp-sass\node_modules\node-sass\lib\index.js:188:15)
    at Module._compile (module.js:446:26)
    at Object.Module._extensions..js (module.js:464:10)
    at Module.load (module.js:341:32)
    at Function.Module._load (module.js:296:12)

Interestingly, if I use pangyp to manually build a binary using Visual Studio 2013 Update 4, I also get a similiar error:

[17:48:54] Error: Module did not self-register.
    at Error (native)
    at Module.load (module.js:341:32)
    at Function.Module._load (module.js:296:12)
    at Module.require (module.js:351:17)
    at require (module.js:370:17)
    at Object.<anonymous> (D:\test\node_modules\gulp-sass\node_modules\node-sass\lib\index.js:188:15)
    at Module._compile (module.js:446:26)
    at Object.Module._extensions..js (module.js:464:10)
    at Module.load (module.js:341:32)
    at Function.Module._load (module.js:296:12)

@metabench
Copy link

@F21 I have got that very same error (Error: Module did not self-register.) after using pangyp to build my own module (not node-sass). I'm using nan 1.6.2. It had been building in node 0.12.0 without a problem.

@F21
Copy link
Author

F21 commented Feb 26, 2015

I was using node 0.10 which was working perfectly and decided to move to io.js to see if my build tools still work. Looks like I will have to move back to node.js for now.

@am11
Copy link
Contributor

am11 commented Feb 26, 2015

@F21,

Once again, this is mainly due to the strong names: #694. But even after that fix, this particular use case won't work for Windows.

Which use-case?

You are using iojs, but you are (unintentionally) calling it with its node.exe alias (which unfortunately is not just an alias or a symlink in Windows).

This only applies to Windows:

First of all, Quick Solution to your problem is:

mkdir \temp; cd \temp
npm install npm
iojs node_modules\npm\bin\npm-cli.js install node-sass
# success!

As you can see, io.js needs to be initiated with iojs prefix, instead of node (which should be just an alias, but in Windows case it is a full blown thing: .exe file!!). But this is due to (aforementioned) our wrong strong naming convention.

Now that the naming convention is fixed and we are using v8 version instead of the runtime name, will I NEVER get this issue again?

For Linux/Mac most probably yes, for Windows no! See: nodejs/node#871 and appveyor/ci#139.

As you can see, there is no straightforward solution to this complex (?) problem. But to quickly reproduce what exactly is wrong, once you finish installing node-sass with iojs prefix, first test it with iojs:

iojs -v
# should be v1.2
iojs -p "console.log(require('node-sass').renderSync({data:'a{b:c}'}))"
# should print:
{ stats:
   { entry: 'data',
     start: 1424944152451,
     includedFiles: [],
     end: 1424944152452,
     duration: 1 },
  css: 'a {\n  b: c; }\n',
  map: '{}' }

Then rename node-sass\vendor\win32-x64-iojs-1.2\binding.node to node-sass\vendor\win32-x64-node-1.2\binding.node, then try to run node-sass with node v1.2 (which packs with iojs):

node -v
# should be v1.2
node -p process.execPath
# should be the path to iojs directory and it should be node.exe (not node.cmd)
# if it is node.cmd, that means you are probably using nvmw, which has the cool
# workaround for it, see iojs issue I linked above for details.
# To proceed with reproducing this bug, you should have a system level
# io.js v1.2 installed.
node -p "console.log(require('node-sass').renderSync({data:'a{b:c}'}))"
# will throw module registration exception
# ^^^^^ this is the actual problem, which I am trying to describe to iojs folks

@boopathi
Copy link

I use iojs instead of node and all my downloads will try iojs-0.10 for node and iojs-1.3 for iojs ..

I think that the download link should not take the executable name.

@am11
Copy link
Contributor

am11 commented Feb 26, 2015

@boopathi, yes and that issue has been fixed.

@am11
Copy link
Contributor

am11 commented Feb 26, 2015

Closing this as external. The quick workaround is to use iojs prefix (instead of node) when using io.js runtime.

Alternatively, install nvmw, which has circumvented this issue by injecting node.cmd in the io.js folder. (see the aforementioned appveyor and io.js issues)

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

4 participants