0

I'm having issues installing lwc-jest on a mac. The npm package installation fails with:

make: /usr/local/bin/g++-4.2: No such file or directory

make: *** [Release/obj.target/deasync/src/deasync.o] Error 1

gyp ERR! build error

Full output: https://justpaste.it/6k63k

I can see there is an error around g++-4.2, it looks like I do have g++ installed. Does it need to be that specific version?

Can anyone give some guidance on how to get past this?

Thanks!

  • I don't have a Mac anymore but last I looked you needed to install the Xcode developer tools package to have gcc and g++ available. – David Reed Feb 1 at 13:47
  • Thanks David, I have xcode dev tools installed and have both gcc and g++, just not version g++-4.2 it seems, I have g++-8. – Dan Nicholson Feb 4 at 9:20
4

First, try downgrading Node to version v8.12.0.

If that does not work, you can try the links from the deasync Installation section of their README.


A deeper explanation...

Currently the Lightning Web Component compiler only has an async compile API, but Jest only supports synchronous transforms. Thus, for our Jest transformer to work we use deasync to force the async compile API to be synchronous. deasync provides it's own binaries for certain OS + Node version combinations. If the binaries are not found, it compiles some C++ code.

During this compilation is typically where people run into issues. Hopefully using an older version of Node will solve your issue and you won't have to worry about getting the other tools necessary for compilation, which is a bit more involved.

For a long term solution we hope to remove this dependency on the deasync library, but will involve some work since Jest is very unlikely to support asynchronous transforms. See Jest issues #2711 and #5556.

  • Downgrading has worked for me (to Node 8.15). Thanks! – Dan Nicholson Feb 11 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.