ajv-formats
ajv-formats copied to clipboard
Cannot read properties of undefined (reading 'code')
Cannot read properties of undefined (reading 'code')
TypeError: Cannot read properties of undefined (reading 'code')
at addFormats (/home/ettinger/src/avenasea.com/avenasea-ui/node_modules/ajv-formats/dist/index.js:30:26)
at Proxy.formatsPlugin (/home/ettinger/src/avenasea.com/avenasea-ui/node_modules/ajv-formats/dist/index.js:15:5)
at [email protected]:8:12
import Ajv from 'ajv';
import addFormats from 'ajv-formats';
const ajv = new Ajv({ allErrors: true, strictSchema: false });
addFormats(ajv);
@ralyodio faced the same issue. Found following workaround:
const instance = new Ajv();
if (!instance.opts) {
// @ts-ignore
instance.opts = { code: {} };
}
const ajv = addFormats(instance);
It looks like node platform issue, all works fine on macOs and crashes on linux.
This doesn't work on my Mac:
MacBook Pro (14-inch, 2021)
Chip: Apple M1 Pro
The Same. Have these issues on my MacBook Pro (14-inch 2021), Chip: M1 Pro. Workaround helped