Yarn - Node Sass does not yet support my current environment
Asked Answered
P

7

34

I'm using Sage WordPress starter theme - https://github.com/roots/sage.

From today when I run yarn build (webpack --progress --config /webpack.config.js) appears this error: Module build failed: ModuleBuildError: Module build failed: Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (72) For more information on which environments are supported please see: https://github.com/sass/node-sass/releases/tag/v4.8.3

I also try to uninstall and reinstall node, npm & yarn with brew, but nothing change.

If I run npm install this is the error

../src/create_string.cpp:17:25: error: no matching constructor for initialization of 'v8::String::Utf8Value'
  v8::String::Utf8Value string(value);
                        ^      ~~~~~
/Users/MYPC/.node-gyp/12.1.0/include/node/v8.h:3002:5: note: candidate constructor not viable: no known conversion from 'v8::Local<v8::Value>' to 'const v8::String::Utf8Value'
      for 1st argument
    Utf8Value(const Utf8Value&) = delete;
    ^
/Users/MYPC/.node-gyp/12.1.0/include/node/v8.h:2995:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided
    Utf8Value(Isolate* isolate, Local<v8::Value> obj);
    ^
1 error generated.
make: *** [Release/obj.target/binding/src/create_string.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/MYPC/mysiteteam/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/usr/local/Cellar/node/12.1.0/bin/node" "/Users/MYPC/mysiteteam/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/MYPC/mysiteteam/node_modules/node-sass
gyp ERR! node -v v12.1.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
npm WARN [email protected] requires a peer of webpack@^1.13.2 || ^2.7.0 || ^3.11.0 || ^4.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! **[email protected] postinstall: `node scripts/build.js`**
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/MYPC/.npm/_logs/2019-05-03T16_22_30_277Z-debug.log

So i'm trying to rebuild node-sass with this command line npm rebuild node-sass --force but the error it's the same!!!

More infos

MacOs Mojave Version 10.14.4

2,7 GHz Intel Core i7

npm -v

6.9.0

node -v

v12.1.0

yarn -v

1.15.2

package.json dependencies

  "devDependencies": {
    "autoprefixer": "~8.2.0",
    "browser-sync": "~2.24.7",
    "browsersync-webpack-plugin": "^0.6.0",
    "bs-html-injector": "~3.0",
    "buble-loader": "^0.4.1",
    "cache-loader": "~1.2.5",
    "clean-webpack-plugin": "^0.1.18",
    "copy-globs-webpack-plugin": "^0.2.0",
    "css-loader": "^0.28.9",
    "cssnano": "~4.0.5",
    "eslint": "~4.19.1",
    "eslint-loader": "~1.9",
    "eslint-plugin-import": "~2.14.0",
    "extract-text-webpack-plugin": "~3.0.2",
    "file-loader": "^1.1.6",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "imagemin-mozjpeg": "~7.0.0",
    "imagemin-webpack-plugin": "~2.2.0",
    "import-glob": "~1.5",
    "node-sass": "~4.9.4",
    "postcss-loader": "~2.1.0",
    "postcss-safe-parser": "~3.0",
    "resolve-url-loader": "~2.3.1",
    "rimraf": "~2.6",
    "sass-loader": "~6.0",
    "style-loader": "^0.22.1",
    "stylelint": "^8.4.0",
    "stylelint-config-standard": "~18.2.0",
    "stylelint-webpack-plugin": "^0.10.5",
    "uglifyjs-webpack-plugin": "^1.3.0",
    "url-loader": "^0.6.2",
    "webpack": "~3.10.0",
    "webpack-assets-manifest": "^1.0.0",
    "webpack-dev-middleware": "~2.0.4",
    "webpack-hot-middleware": "~2.22.3",
    "webpack-merge": "~4.1.4",
    "yargs": "~11.0.0"
  },
  "dependencies": {
    "jquery": "^3.3.1",
    "slick-carousel": "^1.8.1",
    "popper.js": "^1.14.7"
  }

What am I doing wrong?

Pumice answered 3/5, 2019 at 16:33 Comment(3)
There is table showing the supported node versions for node-sass v4.8.3 in the link provided by the error. Upgrade node-sass or downgrade nodeJournalize
sorry but I paste the wrong message Module build failed: ModuleBuildError: Module build failed: Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (72) For more information on which environments are supported please see: github.com/sass/node-sass/releases/tag/v4.9.4 that was a test ;)Pumice
It's still the same. The highest supported node version is v10 and you're using node v12Journalize
S
47

I'm using OSX latest version(10.14.4 (18E226)) and node 12.

While using node-sass 4.11, I had g++ error(../src/create_string.cpp:17:25: error: no matching constructor for initialization of 'v8::String::Utf8Value') while trying npm install, npm rebuild(link) which did not work.

I solved this by updating node-sass to 4.12(npm install node-sass), as the github issue on the node-sass says that support for node 12 is implemented in 4.12 version.

Stove answered 8/5, 2019 at 7:40 Comment(3)
What could be worse, the step mentioned here, failed for me with the same issue as in the question.Wall
@Wall check if you have another dependency that depends on [email protected]. I had an old version of @rails/webpacker that had a dependency on "node-sass": "^4.11.0", and running yarn upgrade @rails/webpacker fixed my build. You can check for it by searching your yarn.lock or package-lock.jsonApple
Best answer ever, every npm i would give me a headache in our current env due to Node sass failing.Discriminator
E
10

this is what worked for me. Downgrade your node version to 10.16.0 node 12 still has some issues

Elm answered 23/7, 2019 at 14:52 Comment(2)
node 13.7.0 also has this problem. Installing node 10.18 solved this one, but there's yet another failure ../src/sass_types/list.cpp:28:19: error: no matching function for call to 'sass_make_list'. Update of node-sass dependency to latest 4.13.1 doesn't help with either node 13.7 nor 10.18Frilling
Fixed the other one by removing project-local node_modules when switching node versions to get rid of the remains of failed builds.Frilling
O
7

Upgrade node-sass to 4.12.0 and it will fix the issue.

Orissa answered 10/6, 2019 at 16:12 Comment(1)
More info: The node-sass Readme says "Supported Node.js versions vary by release, please consult the releases page."Chukchi
I
4

node 12 have this problem when run npm install node-sass,downgrading node to 10.16 works

Idona answered 25/7, 2019 at 8:24 Comment(1)
More info: The node-sass Readme says "Supported Node.js versions vary by release, please consult the releases page."Chukchi
R
4

For me, this solution works. here are the steps:

  1. go to node-sass folder (it can be "../node_modules/node-sass/src" or somewhere else, for example for Angular it is located in "../node_modules/@angular-devkit/build-angular/node_modules/node-sass/src") you can find the location in logs: logsImage
  2. open create_string.cpp
  3. change v8::String::Utf8Value string(value); to v8::String::Utf8Value string(v8::Isolate::GetCurrent(), value);

if you couldn't find "node-sass" folder rerun "npm install" and when you see node-sass logs in the console, terminate the process with ctrl+c.

Rowden answered 12/9, 2019 at 4:40 Comment(2)
Upgrading to node-sass 4.12.x or 4.13.x didn't solve my problem, and the above didn't exist in my file which contained the following: ``` char* create_string(Nan::MaybeLocal<v8::Value> maybevalue) { v8::Local<v8::Value> value; if (maybevalue.ToLocal(&value)) { if (value->IsNull() || !value->IsString()) { return 0; } } else { return 0; } Nan::Utf8String string(value); char *str = (char *)malloc(string.length() + 1); strcpy(str, *string); return str; } ```Ceres
Only thing that worked was to switch to Node version 11.15.0Ceres
A
0

If anyone is using Amazon EC2 AMI Image then follow below instructions

  1. Install nvm only from https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html
  2. nvm ls-remote
  3. nvm install v10.16.0

node-sass build will be successful as per your AMI Image.

Agalloch answered 26/6, 2020 at 5:24 Comment(0)
C
0

There is another good answer on Github related to npm-sass - node compatibility. (MacOS related issue)

https://github.com/sass/node-sass/issues/2549#issuecomment-851609577

Contravene answered 13/1, 2023 at 13:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.