wasm code commit Allocation failed - process out of memory

This issue has been fixed in Node 15.3.0.

I updated mine and it worked fine for me.


Can't upgrade node & need a quick two minute solution?

For anyone who is on an M1 computer and suffering from this issue and cannot upgrade their node version for whatever the reason may be, there is still a quick & easy workaround:

  1. Go to your Application/Utilities folder where your Terminal resides. (An easy way to find this is right click on your terminal icon and click "Open in finder".) Here is a screenshot: Picture depicting the Application/Utilities directory and right clicking on the "Terminal" application and highlighting the "Duplicate" option
  2. Right click on terminal and click "Duplicate" and then rename the new terminal to something like "Rosetta-Terminal". (Bottom left in the screenshot above.)
  3. Right click on Rosetta-Terminal --> "Get Info" --> select "Open using Rosetta". Image of duplicated terminal that is showing the clicking of "Open using Rosetta" option
  4. Now open the Rosetta-Terminal and using nvm type nvm uninstall YOUR.VERSION.HERE. (Note: it may say that it's unable to install it since you're currently using it, in which case just install any other version temporarily and use that.) If you do not have nvm then you can install it here or by running: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash.
  5. nvm install YOUR.VERSION.HERE

Boom, now your node is installed under Rosetta and it should work fine without the need to upgrade your node version.

Rosetta is Apple's way of allowing apps built for the Intel chip to work with Apple Silicon.

It's not always easy to upgrade your node version as other answers seem to suggest. For example perhaps you have other dependencies that require a specific node version and upgrading those dependencies would require a significant lift and shift of your app - luckily for those scenarios we have Rosetta.


Currently, node on M1 macOS doesn't work well except node@15. If you using node@12 built on arm64 architecture, it may be crashed on some scripts such as https://github.com/dcodeIO/long.js.git

You can check it if you run test cases in long.js repository.

If you would like to know on which your node is built, please follow this:

$ node

Welcome to Node.js v12.21.0.
Type ".help" for more information.
>
> process.arch
'arm64'

The above example means the node binary is built for arm64 architecture (Apple Silicon M1 chip). If node is run on rosetta2, it will display 'x64'.

I have tested some test cases in long.js and node.js source repository.

  • Node@15 for arm64: no problem
  • Node@12 for arm64: some errors in long.js and node.js test cases
  • Node@12 for x64: no problem

As I know, node@12 for arm64 works well for some scripts, but some scripts has been crashed such as long.js.

Edit

On June 21th, 2021, node@14 on Homebrew has passed long.js test cases for arm64. (v14.17.1) Of course, node@16 also supports it.

But, node@12 still has errors on them. (v12.22.1)

Tags:

Node.Js

Npm

Nvm