Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using js-yaml together with js-yaml-js-types #637

Closed
SolomoN-ua opened this issue Aug 20, 2021 · 1 comment
Closed

Error when using js-yaml together with js-yaml-js-types #637

SolomoN-ua opened this issue Aug 20, 2021 · 1 comment

Comments

@SolomoN-ua
Copy link

Hi guys,

After update to latest js-yaml version (4.1.0) inside of our project load-grunt-config some of our users started receiving following error:

>> YAMLException: Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })
Warning: Task "default" not found. Use --force to continue.

code that we are using is quite simple:

var yaml = require('js-yaml');
var schema = yaml.DEFAULT_SCHEMA.extend(require('js-yaml-js-types').regexp);

you can find it here

After some investigation looks like the issue is with the following check

if (definition instanceof Type) {

Looks like the possible reason is multiple versions of js-yarn (including old 3.x.x) inside the node_modules, because of different other dependencies. Maybe it could be fixed by adding js-yarn as non-dev dependency inside of js-yaml-js-types, but that is just an idea. Or maybe the check itself should be improved somehow.

Could you please help us to resolve this issue?

Some other details:
js-yaml: 4.1.0
js-yaml-js-types: 1.0.0
link to the original issue: firstandthird/load-grunt-config#194

@puzrin
Copy link
Member

puzrin commented Aug 20, 2021

IMO npm's dependency graph is a bit out of scope. You could delete deps, lockfile and install deps from scratch.

If you try to report a bug - then create a minimalistic example, confirming unexpected behavior (without extra dependencies).

@puzrin puzrin closed this as completed Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants