Error C2664 on build

Hi, I’m trying to build the source and received the following error when running

yarn install --pure-lockfile:
error C2664: ‘v8::String::Utf8Value::Utf8Value(const v8::String::Utf8Value &)’: cannot convert argument 1 from ‘v8::Localv8::Value’ to ‘const v8::String::Utf8Value &’ [C:\Projects\Grafana\src\github.com\grafana\grafana\node_modules\node-sass\build\binding.vcxproj]

I’m building on a Windows 10 PC. Yarn version 1.15.2. NodeJS version v12.0.0. npm version 6.9.0.

Does your node installation work? Have you installed node-gyp?

See the Building on Windows section for extra instructions for node-gyp: https://grafana.com/docs/project/building_from_source

Yes, my node installation works. I’ve installed node-gyp.
I reinstalled it and I still get the same errors…

I just googled this quickly and there are loads of people with similar problems with node, node-gyp and Windows.

There are a couple of different ways to install node-gyp. Are you using Python or the Visual Studio build tools? Looks like you have a problem with one of those.

I’m using the VS build tool.

Did you find a fix on Google (this is a common problem I think)? Not sure what your environment looks like (do you have multiple versions of Visual Studio installed etc.)

Probably something to do with node-gyp using the wrong version of the tools for your version of node.

  • Try installing node-gyp again using the node-gyp configure --msvs_version=xxx where xxx is the correct version of the vs tools.
  • Delete your node_modules directory.
  • yarn install --pure-lockfile

If that doesn’t work then you need to provide more information. Try running:

yarn install --verbose --pure-lockfile

And also, how did you install the build tools? Which version? Do you have Visual Studio installed as well? Did you install python?

Nothing seems to work… I have VS2017 installed and working… Python 3.7, Yarn version 1.15.2. NodeJS version v12.0.0. npm version 6.9.0.
Build verbose log file: https://1drv.ms/t/s!Agf00pIM7oRIkUghtmH6TSKhhzp3?e=VdEK0k
Thanks for the help!

Seems it is this problem: https://github.com/sass/node-sass/issues/2632 that node-sass 4.11.0 does not have support for node v12. Node 12 came out a few weeks ago and is the most recent version and not the LTS so you are living on the bleeding edge.

Grafana has not been updated to node-sass 4.12.0 yet (it only came out a week ago) but saw that someone in that thread had the same problem as you so not sure that 4.12.0 will fix it.

  • If you are using a node version manager like nvm then you can just switch to an earlier version of node.
  • If that is a pain, then try updating node-sass to 4.12.0 in Grafana (this will be upgraded in master soon, we upgrade npm packages regularly):
    yarn upgrade --latest node-sass

YES! That did it. Thanks a lot!
I propose to add this info to the FAQ…

We ran into this issue earlier last week (Nov 2019) and discovered that the NPM pull for 14.11 doesn’t exist anymore. It gave us a 404. When we switched to 14.12, it pulled down the files and the build went on its merry way.

Cheers!