Oz compile fails with spawnSync /bin/sh ENOBUFS

I get the following error when trying to oz compile:

Setup:

  • macOS Catalina 10.15.1
  • nvm
  • node -v 12.13.0
  • npm -v 6.12.0
  • globally installed @openzeppelin/cli@2.6.0

I do not get the bug for nvm node -v 10.17.0:

1 Like

Hi @gitpusha,

I can reproduce when attempting oz compile https://github.com/gelatodigital/gelato/ on node v12.7.0 on Windows Subsystem for Linux.

I resolved by using the latest version of the compiler (this will update your project.json too).

gelato$ oz compile --solc-version 0.5.13
āœ“ Compiled contracts with solc 0.5.13 (commit.5b0b510c)

I can reproduce with just the following contract:

pragma solidity ^0.5.0;

import "@openzeppelin/upgrades/contracts/Initializable.sol";

import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC721/ERC721Full.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC721/ERC721Mintable.sol";

contract Token is Initializable, ERC721Full, ERC721Mintable {

}

As an aside, I noticed import "@openzeppelin/contracts/utils/Address.sol"; rather than using @openzeppelin/contracts-ethereum-package.

Also @openzeppelin/contracts-ethereum-package is now at version 2.4.0

1 Like

EDIT: I think you configure solc version inside project.json, correct?

How do you go about updating solc version with oz - I though that oz manages its own compiler. I inferred from your answer that you npm installed solc as its own dependency into the project, which I guess overrides the oz solc ?

1 Like

Thanks, configuring solc version 0.5.13 in my project.json file did the trick for me.

1 Like

Hi @gitpusha,

Apologies that my answer wasn't clear.

You can specify the solc version to use in the compile command.
e.g. oz compile --solc-version 0.5.13

https://docs.openzeppelin.com/sdk/2.5/api/cli#compile
--solc-version [version]
version of the solc compiler to use (value is written to configuration file for future runs, defaults to most recent release that satisfies contract pragmas)

This will update the configuration file project.json which includes the compiler version to use.

In this case oz compile --solc-version 0.5.13 will change the compiler from 0.5.12 to 0.5.13 in project.json (for future compiles) and compile the contracts with 0.5.13.

A post was split to a new topic: Node 14 oz compile fails with spawnSync /bin/sh ENOBUFS