Node-sass: support for node.js 12.x

Created on 23 Apr 2019  路  16Comments  路  Source: sass/node-sass

node v12.0.0 just got released: https://nodejs.org/en/blog/release/v12.0.0/

installation is failing on macOS mojave

  • NPM version (npm -v): 6.9.0
  • Node version (node -v): 12.0.0
  • Node Process (node -p process.versions): [see below]
  • Node Platform (node -p process.platform): darwin
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"): Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (72)
  • npm node-sass versions (npm ls node-sass): [email protected]
// process.versions:
{
  node: '12.0.0',
  v8: '7.4.288.21-node.16',
  uv: '1.28.0',
  zlib: '1.2.11',
  brotli: '1.0.7',
  ares: '1.15.0',
  modules: '72',
  nghttp2: '1.38.0',
  napi: '4',
  llhttp: '1.1.1',
  http_parser: '2.8.0',
  openssl: '1.1.1b',
  cldr: '34.0',
  icu: '63.1',
  tz: '2018e',
  unicode: '11.0'
}
Node 12

Most helpful comment

Installation and compile is failing on windows.
image
And when I change
v8::String::Utf8Value string(value);
to
v8::String::Utf8Value string(v8::Isolate::GetCurrent(), value);

It's works!
Seems String::Utf8Value with one arg is removed in new V8 of node 12.

All 16 comments

Updated. We have a PR in #2633 but are blocked on the nodejs team updating nan for Node 12.

Created a tracking issue https://github.com/nodejs/nan/issues/849

Installation and compile is failing on windows.
image
And when I change
v8::String::Utf8Value string(value);
to
v8::String::Utf8Value string(v8::Isolate::GetCurrent(), value);

It's works!
Seems String::Utf8Value with one arg is removed in new V8 of node 12.

@xzyfer - Looks like the compilation error is originating from that unshimmed v8 string constructor, which is no longer valid. Not actually something NAN updates will fix.

You could use https://github.com/nodejs/nan/blob/master/doc/v8_misc.md#nanutf8string though.

@EricMCornelius I believe the compilation is because that nan API is using the wrong constructor.

../node_modules/nan/nan_implementation_12_inl.h:337:37: error: too few arguments to function call, expected 2, have 1
  return v8::StringObject::New(value).As<v8::StringObject>();

@xzyfer - I get the error @jiqiangbing highlighted above at: https://github.com/sass/node-sass/blob/master/src/create_string.cpp#L17 during compilation.

Aside from that, a clean build from master is working fine on my local. Just changed line #17 to the Nan::Utf8String constructor.

@EricMCornelius even with those changes I was getting build errors locally. Looks like I had an older version on nan when I needed at least 2.13.2 - See https://github.com/nodejs/nan/blob/master/CHANGELOG.md#2132-mar-24-2019

In file included from ../src/binding.cpp:1:
In file included from ../node_modules/nan/nan.h:2657:
../node_modules/nan/nan_object_wrap.h:24:25: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object,
      v8::NonCopyablePersistentTraits<v8::Object> >'
    assert(persistent().IsNearDeath());

CI is happy. Now we're just waiting for https://github.com/appveyor/ci/issues/2921

If you need to get this working my solution was just to npm-install the node-12 branch of @xzyfer

npm install https://github.com/xzyfer/node-sass.git#node-12

I don't understand why @i5o's comment was marked as off-topic, it provides a genuine workaround for people who are awaiting the resolution of this issue.

I have the same problem after update my node to 12.0.0

@mtimofiiv the branch is ephemeral. Taking that advice will end up in your install breaking when the branch is deleted. Noone _needs_ to use Node 12. The only reasonable solution is to wait.

Locked this issue since there is no need for further discussion. We know what needs to be done and we're working on it.

Re-opening because it'll take a day to build the binaries.

Published as 4.12.0

Was this page helpful?
0 / 5 - 0 ratings