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

npm ERR! node-sass@2.0.1 postinstall: node scripts/build.js npm #693

Closed
metasean opened this issue Feb 22, 2015 · 44 comments
Closed

npm ERR! node-sass@2.0.1 postinstall: node scripts/build.js npm #693

metasean opened this issue Feb 22, 2015 · 44 comments

Comments

@metasean
Copy link

While trying to install an npm package that requires gulp-sass, I'm getting installation errors for node-sass.

Background to explain output and log

I have one Snow Leopard and one Lion partition on my MacBook. I'm using Snow Leopard, but accessing a shared projects directory that is based in the Lion partition. For clarity in the output and log, I've changed the usernames to indicate which is which.

I have been using this dual system with npm for almost a year now. I've got over 700 packages in my user .npm directory, and never had a problem like this. In this case, I was installing the node packages for MEAN.js and the other 76 packages installed without a hiccup.

npm install node-sass

When trying to run npm install node-sass from iojs-v1.2.0, I get the following (I started with node v0.10.36, v0.33.00, and node v0.12.0 and got similar results with each):

-
> node-sass@2.0.1 install /Volumes/Lion Partition/Users/userOnLion/projects/adLoc-meanjs-node/node_modules/node-sass
> node scripts/install.js


> node-sass@2.0.1 postinstall /Volumes/Lion Partition/Users/userOnLion/projects/adLoc-meanjs-node/node_modules/node-sass
> node scripts/build.js

`darwin-x64-iojs-1.2` exists; testing
module.js:341
  Module._extensions[extension](this, filename);
                               ^
Error: dlopen(/Volumes/Lion Partition/Users/userOnLion/projects/adLoc-meanjs-node/node_modules/node-sass/vendor/darwin-x64-iojs-1.2/binding.node, 1): Library not loaded: /usr/lib/libc++.1.dylib
  Referenced from: /Volumes/Lion Partition/Users/userOnLion/projects/adLoc-meanjs-node/node_modules/node-sass/vendor/darwin-x64-iojs-1.2/binding.node
  Reason: image not found
    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> (/Volumes/Lion Partition/Users/userOnLion/projects/adLoc-meanjs-node/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)
npm ERR! Darwin 10.8.0
npm ERR! argv "node" "/Users/userOnSnowLeopard/.nvm/versions/io.js/v1.2.0/bin/npm" "install" "node-sass"
npm ERR! node v1.2.0
npm ERR! npm  v2.5.1
npm ERR! code ELIFECYCLE

npm ERR! node-sass@2.0.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@2.0.1 postinstall script 'node scripts/build.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/build.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-sass
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Volumes/Lion Partition/Users/userOnLion/projects/adLoc-meanjs-node/npm-debug.log

npm-debug.log

The npm-debug.log is available at https://gist.githubusercontent.com/metasean/6f2a4db81313fd971dfb/raw/npm-debug.log_for_npm_install_node-sass

_Any ideas on how I might be able to get node-sass to fully install?_

@metasean
Copy link
Author

I copied the project from my Lion partition to my Snow Leopard partition and ran npm install and am still getting similar errors.

@xzyfer
Copy link
Contributor

xzyfer commented Feb 22, 2015

The error message is suggests that our osx binaries aren't compatible with
older versions of osx. They were compiled on 10.9 (mavricks) which is newer
than the versions you're running.

@andrew can you please confirm what version of osx you were previously
compiling the binaries on?

/cc @am11
On 22 Feb 2015 14:01, "metasean" notifications@github.com wrote:

I copied the project from my Lion partition to my Snow Leopard partition
and ran npm install and am still getting similar errors.


Reply to this email directly or view it on GitHub
#693 (comment).

@andrew
Copy link
Contributor

andrew commented Feb 22, 2015

I've been using 10.9 for the past year or so to build the Mac binaries.

@am11
Copy link
Contributor

am11 commented Feb 22, 2015

For both versions of Mac, please make separate gist with the output for this script (in case it fails as well): https://gist.github.com/am11/e5de3c49c219f0811e1d#comment-1386582.

That might help us narrowing down the issue.

@pheew
Copy link

pheew commented Feb 22, 2015

I'm also having trouble on Arch linux.
My npm-debug.log and output of the script mentioned by @am11 (installing gulp-sass):
https://gist.github.com/pheew/3540d5a86c5df835481f#file-

@am11
Copy link
Contributor

am11 commented Feb 22, 2015

@pheew, going by your logs, everything seems fine. :)

On top of it, you can re-reconfirm by compiling little Sass:

With pwd == /temp1:

$ node
// this is node interactive console
require('node-sass').render({data: 'a{b:c}', success: function(result) {console.dir(result)}})

If that works as well, then it could be the npm cache thingy (https://docs.npmjs.com/cli/cache) or gulp-sass issue..

@pheew
Copy link

pheew commented Feb 22, 2015

Yeah, it does seem to install correctly when just installing it seperately, ie: npm install node-sass
I cleared the cache and tried again but still have the same error when running: npm update gulp-sass

4496 verbose stack Error: node-sass@0.9.6 install: `node build.js`
4496 verbose stack Exit status 1
4496 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
4496 verbose stack at EventEmitter.emit (events.js:110:17)
4496 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:14:12)
4496 verbose stack at ChildProcess.emit (events.js:110:17)
4496 verbose stack at maybeClose (child_process.js:1008:16)
4496 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
4497 verbose pkgid node-sass@0.9.6 

That said, i'm not entirely sure it's a node-sass issue.

@pheew
Copy link

pheew commented Feb 22, 2015

Ah, appears I've solved the issue. I've totally read over the python errors in the output. Forcing python to v2.7 by calling:

npm update --python=python2.7

solved the issue on my part. Thanks for the help!

@am11
Copy link
Contributor

am11 commented Feb 22, 2015

node-sass@0.9.6

Ouch! That's a very old version. The latest stable is at 2.0.1 mark.

@pheew
Copy link

pheew commented Feb 22, 2015

Haha, yeah, it's been a while. Have not been working on the frontend for a while :)

@am11
Copy link
Contributor

am11 commented Feb 22, 2015

Congrats! BTW it should not require consumer to have python installed. Python is required to manually build the binary, which kicks in when the prebuild binary is incompatible; something which we are trying to avoid (#655). I would suggest to upgrade node-sass version to 2.0.1 in gulp-sass.

@metasean
Copy link
Author

@xzyfer, @andrew, & @am11 -
Holy smokes, y'all are the most responsive project I've ever dealt with. Thank you!

@am11 -

I did a find and replace on the machine (partition) and user names, just to make sure it was clear which partition was which.

@am11
Copy link
Contributor

am11 commented Feb 22, 2015

@metasean, that is too verbose than necessary and makes it 10x harder to parse! Besides, you don't have to copy paste my entire gist with the comment there.

I specifically referenced a link to a gist comment for Mac, which says:

For Linux/Mac:

mkdir /temp1
cd /temp1

# diagnostic information
npm -v              
node -v
node -p process.versions
node -p process.platform
node -p process.arch

# installation
npm install node-sass

# if installed successfully
node -p console.log(require('node-sass').info())

# else if it fails
cd node_modules/node-sass/vendor

# delete darwin-or-linux<something>\binding.node file and 
# download the appropriate file in that directory manually from:
# https://github.com/sass/node-sass-binaries/tree/v<<insert-latest-version-here>>
#
# (for instance: https://github.com/sass/node-sass-binaries/tree/v2.0.1)

node -p console.log(require('node-sass').info())

# once this is done, delete temp1
rm -r /temp1

Please read the instructions, run the commands and only show the outputs like @pheew did in his 43-liner reply gist: https://gist.github.com/pheew/3540d5a86c5df835481f#file-.

@metasean
Copy link
Author

@am11 - sorry for the misunderstanding :-( Thank you for your patience!

I did have some problems with some of the steps, so there are comments related to those. I have to reboot into the Lion side, so it'll be a few minutes before I have those results.

Snow Leopard gist

@am11
Copy link
Contributor

am11 commented Feb 22, 2015

Please try running this command again as root/Administrator.

I think you need to run those commands with sudo prefix.

@metasean
Copy link
Author

On the Lion side, running sudo, everything looks good until node -p console.log(require('node-sass').info()) which results in -bash: syntax error near unexpected token(' (The github markdown and the terminal results are getting a little confused on the end; the actual ending is the word token, space, back tick, open parens, and single quote; as shown in the corresponding gist.)

Lion gist

Back in a few minutes with the Snow Leopard results when running sudo.

@am11
Copy link
Contributor

am11 commented Feb 22, 2015

You can try wrapping the node command in quotes like so:

node -p "console.log(require('node-sass').info())"

@metasean
Copy link
Author

So the Snow Leopard side (where I spend 95% of my time) is still not happy, even with sudo. :-(

Snow Leopard sudo gist

@am11
Copy link
Contributor

am11 commented Feb 22, 2015

Nice work reproducing it in isolated mode. 👍

(Just to dismiss all doubts) At this point, if you delete this file /temp1/node_modules/node-sass/vendor/darwin-x64-node-0.10/binding.node and replace it with: https://github.com/sass/node-sass-binaries/blob/v2.0.1/darwin-x64-node-0.10/binding.node?raw=true and try running node -p "console.log(require('node-sass').info())" again, does it work?

@metasean
Copy link
Author

On Lion, the replacement binding.node file results in:

node-sass version: 2.0.1
libsass version: 3.1.0
undefined

I assume the node-sass and lib sass versions are a good sign. Is the 'undefined' expected?

Unfortunately, Snow Leopard still doesn't make it successfully past the install command - Snow Leopard sudo gist 😦

@am11
Copy link
Contributor

am11 commented Feb 23, 2015

As for Lion: I don't know why the download script is unable to download the binding.node in first place. Are you behind network proxy server?

It seems like the binary is incompatible with Snow Leopard. @xzyfer any ideas how can we achieve the binary compatibility for OSX 10.6? Does it follow the same rule as CentOS: build binary with lowest version of C/C++ runtime we are aiming to support?

@metasean
Copy link
Author

I'm normally behind a proxy, but I definitely haven't been the last couple of days. So I'm not sure why the binding.node might have been a problem.

Out of curiosity, was "undefined" the expected last line for the node -p "console.log(require('node-sass').info())" output?

Thank you for continuing to check on the Snow Leopard problem! I know it's an old OS, but I have to use it for work.

@xzyfer
Copy link
Contributor

xzyfer commented Feb 23, 2015

@am11 I'm not sure at this point. It appears osx binaries have always been compiled on 10.9 so I wonder if this issue has always existed. Frankly it's rare to come across such old versions of OSX. Apple make it hard to run old versions in order to force users to update.

@metasean have you been able to install node-sass prior to 2.0.1?

@metasean
Copy link
Author

@xzyfer - My backups don't show a node-sass directory in my user .npm directory, so I'm guessing I haven't. Strangely, I know I've had SASS compile in a couple of MEAN apps before, so I guess I'll be digging through old projects later this week to figure out how.

@am11
Copy link
Contributor

am11 commented Feb 23, 2015

@metasean wrote:

Out of curiosity, was "undefined" the expected last line for the node -p "console.log(require('node-sass').info())" output?

Yes. undefined is the result of expression evaluation (in our case console.log), which does not return anything (but prints data on the screen). For instance:

// node interactive console
> console.log('hi')
hi
undefined

// another example:
> function sumTwo(x, y) { return x + y; }
undefined  // when we defined the function, the expression evaluation itself resulted in nothing
> sumTwo(1, 2)
3

@metasean
Copy link
Author

@am11 - My head is hung low in mortified embarrassment 😔.
Regardless, thank you for taking the time to answer my query and provide examples! 👍

@kevinSuttle
Copy link

Got something similar. Happens on npm install and specifically installing the module.
I'm on OSX 10.10.2, using io.js 1.4.1 pkg installer.

❯ npm install --save-dev node-sass
/
> node-sass@2.0.1 install /Users/kevinsuttle/Code/kevinsuttle.github.io/node_modules/node-sass
> node scripts/install.js

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

> node-sass@2.0.1 postinstall /Users/kevinsuttle/Code/kevinsuttle.github.io/node_modules/node-sass
> node scripts/build.js

module.js:322
    throw err;
          ^
Error: Cannot find module '/Users/kevinsuttle/Code/kevinsuttle.github.io/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

@hmalphettes
Copy link

@kevinSuttle got the same stack with iojs-1.4.1 installed via nvm.
I filed a new issue for this: #715

@am11
Copy link
Contributor

am11 commented Feb 27, 2015

node-sass v2.0.1 supports only io.js v1.2.0. We are aiming to expand this coverage in future releases.

kingcody added a commit to kingcody/node-email-templates that referenced this issue Feb 27, 2015
node-sass(2.0.1) does not support iojs > 1.2.0 ATM
see: sass/node-sass#693 (comment)
@am11
Copy link
Contributor

am11 commented Feb 28, 2015

@xzyfer, can you try building darwin binaries on Snow Leopard (for instance, using virtual machine) and test if those are forward compatible with Yosemite (v10.10)? It seems like others are facing the similar compatibility similar backward compatibility issue:http://stackoverflow.com/q/16358957 (also here is a related conversation: https://groups.google.com/forum/#!topic/wx-users/pmzdHVRjW5c).

TravisCI uses fixed version of OSX: 10.9.5 (ref: http://docs.travis-ci.com/user/osx-ci-environment/#CI-environment-OS), otherwise we could easily configure 10.6 in YAML config to build the binaries and upload them to some shared hosting server from the CI job (or upload to GitHub using their API).

@mansona
Copy link

mansona commented Mar 4, 2015

I'm assuming this particular issue isn't isolated to OSX? I've got a very similar stack trace from ubuntu 12.04 on io.js 1.4.x

Also i assume because of #717 this issue will be fixed when #710 is completed?

@am11
Copy link
Contributor

am11 commented Mar 4, 2015

io.js 1.4.x

That version of io.js is not supported by node-sass v2.0.1. Please try downgrading version to 1.2.0 (or better switching io.js version using nvm). Rest assured vNext of node-sass will have forward compatibility with io.js rapidly increasing versions. See #694.

@jemgold
Copy link

jemgold commented Mar 11, 2015

I'm getting this with node@0.10.36, too.

First encountered it a few days ago with aexmachina/ember-cli-sass@3.1.0 which depends on joliss/broccoli-sass@0.4.0…which finally depends on sass/node-sass@2.0.1. Gave up trying to fix that because I had client work to do…until today when my client project, also depending on node-sass (via gulp-sass@1.3.x) broke.

Deleted my node_modules folder; when I try to reinstall deps I get the same error as @kevinSuttle.

Forced using Python 2.7; on OSX 10.10.2 - not sure what else is relevant, but 3.0.0-pre does work.

@am11
Copy link
Contributor

am11 commented Mar 11, 2015

@metasean, v3.0.0-pre is out.

I don't think we will be supporting older versions of Mac or any OS except Linux. So I am closing this as by design.

@mumrah
Copy link

mumrah commented Jun 9, 2015

I am seeing failures on OS X 10.7.5

` /Users/mumrah/Code/lucid/Fusion/Apollo-admin/ui/node_modules/gulp-sass/node_modules/node-sass/vendor/darwin-x64-11/binding.node ` exists. 
 testing binary.
Problem with the binary.
Manual build incoming.
Building: /Users/mumrah/Code/lucid/Fusion/Apollo-admin/ui/build-support/nodejs/node-v0.10.33-darwin-x64/bin/node node_modules/pangyp/bin/node-gyp rebuild --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
  CXX(target) Release/obj.target/libsass/src/libsass/ast.o
cc1plus: error: unrecognized command line option "-std=c++11"
cc1plus: error: unrecognized command line option "-stdlib=libc++"
make: *** [Release/obj.target/libsass/src/libsass/ast.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/mumrah/Code/lucid/Fusion/Apollo-admin/ui/node_modules/gulp-sass/node_modules/node-sass/node_modules/pangyp/lib/build.js:271:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Darwin 11.4.2
gyp ERR! command "/Users/mumrah/Code/lucid/Fusion/Apollo-admin/ui/build-support/nodejs/node-v0.10.33-darwin-x64/bin/node" "/Users/mumrah/Code/lucid/Fusion/Apollo-admin/ui/node_modules/gulp-sass/node_modules/node-sass/node_modules/pangyp/bin/node-gyp" "rebuild" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/mumrah/Code/lucid/Fusion/Apollo-admin/ui/node_modules/gulp-sass/node_modules/node-sass
gyp ERR! node -v v0.10.33
gyp ERR! pangyp -v v2.2.1
gyp ERR! not ok 
Build failed

Any hints?

@kevinSuttle
Copy link

Try node-gyp rebuild?

@xzyfer
Copy link
Contributor

xzyfer commented Jun 9, 2015

@mumrah please read issues fully before posting in the future. Technically we don't support OSX older than 10.9.

As @kevinSuttle suggests you can try rebuilding the binary with node-gyp rebuild.

@saper
Copy link
Member

saper commented Jun 9, 2015

Running node-gyp by hand won't probably help since those options are hard coded in our binding.gyp file. I would recommend @mumrah tries to upgrade Xcode or better yet installing newest clang for example via MacPorts. Then please open a new bug giving your clang version in the report.

@Silom
Copy link

Silom commented Jun 25, 2015

I have the same problem after updating node and this package.
Im running OS X in 10.10.
Node in 0.12.5.
NPM in 2.11.2.

Why is Sass not supported anymore for older mac's, so many people use it in this environment?
.. I mean 10.10 is the latest afaik.

@saper
Copy link
Member

saper commented Jun 25, 2015

We need a pretty complete support of the C++11 standard, which only the latest versions of clang support. If somebody gets it to build using the earlier version and it can be done for the release every time, then it's fine.

@Silom what is your problem exactly? Did you fetch the binary part needed for node 0.12 using node scripts/install.js ?

@Silom
Copy link

Silom commented Jun 25, 2015

@saper I got it working, I just forgot to rm -rf the node_modules after I updated everything you told me :/
.. anyway thanks for the info, the C++ issue is reasonable.

@fdambrosio
Copy link

This workaround worked form me.

Starting with this setup:

Cordova CLI: 5.3.3
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.0
Ionic Version: 1.1.0
Ionic CLI Version: 1.6.5
Ionic App Lib Version: 0.3.9
ios-deploy version: Not installed
ios-sim version: 5.0.1
OS: Mac OS X Yosemite
Node Version: v4.1.1
Xcode version: Xcode 6.4 Build version 6E35b

I followed this step:

sudo npm install -g n
sudo n 0.12.7
sudo npm install node-sass@2
sudo npm -g install node-gyp@3
sudo npm rebuild node-sass
sudo ionic setup sass (for 2 times) 

Ref: http://forum.ionicframework.com/t/error-running-gulp-sass/32311/20

@saper
Copy link
Member

saper commented Oct 4, 2015

@fdambrosio
Copy link

thanks saper

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