Ajv: Missing modules in AJV

Created on 9 Dec 2016  Â·  20Comments  Â·  Source: ajv-validator/ajv

after using AJV with webpack there is missing modules...

WARNING in ./~/ajv/lib/async.js
Module not found: Error: Cannot resolve module 'regenerator' in /home/kepro/Projects/node_modules/ajv/lib
@ ./~/ajv/lib/async.js 95:20-47

WARNING in ./~/ajv/lib/async.js
Module not found: Error: Cannot resolve module 'nodent' in /home/kepro/Projects/node_modules/ajv/lib
@ ./~/ajv/lib/async.js 116:26-48

WARNING in ./~/ajv/lib/compile/index.js
Module not found: Error: Cannot resolve module 'js-beautify' in /home/kepro/Projects/node_modules/ajv/lib
@ ./~/ajv/lib/compile/index.js 8:42-69

compatibility

Most helpful comment

Resolved in 5.0.1-beta.0
To use: npm install ajv@^5.0.1-beta

All 20 comments

What is the version? Wasn't it solved by https://github.com/epoberezkin/ajv/pull/363?

4.10.0:

WARNING in ./~/ajv/lib/compile/index.js
13:21 Critical dependency: the request of a dependency is an expression

WARNING in ./~/ajv/lib/async.js
96:20 Critical dependency: the request of a dependency is an expression

WARNING in ./~/ajv/lib/async.js
119:15 Critical dependency: the request of a dependency is an expression

5.0.0-beta.1:

WARNING in ./~/ajv/lib/compile/index.js
Module not found: Error: Can't resolve 'js-beautify' in 'node_modules/ajv/lib/compile'
 @ ./~/ajv/lib/compile/index.js 13:21-48
 @ ./~/ajv/lib/ajv.js

WARNING in ./~/ajv/lib/async.js
Module not found: Error: Can't resolve 'regenerator' in 'node_modules/ajv/lib'
 @ ./~/ajv/lib/async.js 95:20-47
 @ ./~/ajv/lib/ajv.js

WARNING in ./~/ajv/lib/async.js
Module not found: Error: Can't resolve 'nodent' in 'node_modules/ajv/lib'
 @ ./~/ajv/lib/async.js 116:26-48
 @ ./~/ajv/lib/ajv.js

Webpack doesn't seem to have a way to manage optional dependencies. In any case, these messages are warnings, not errors, they seem to be manageable. See https://github.com/epoberezkin/ajv/issues/117#issuecomment-198328830 for example.

Thanks, it helped

new webpack.IgnorePlugin(/regenerator|nodent|js-beautify/, /ajv/)

Actually I still see these warnings at the end of npm install or yarn. Is there a way to get rid of this?

It will be resolved by #382 and #383

thanks ;)

Resolved in 5.0.1-beta.0
To use: npm install ajv@^5.0.1-beta

Neither v5-beta / Webpack ignore is solving this issue. @epoberezkin can't you fix the module to work as webpack expected with the sources instead of the dist file?

Is it "webpack": "dist/ajv.bundle.js" in package.json makes it work with compiled file? If so, it just has to be removed then.

[0] WARNING in ./~/ajv/dist/ajv.bundle.js
[0] Critical dependencies:
[0] 1:476-483 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
[0]  @ ./~/ajv/dist/ajv.bundle.js 1:476-483

Does removing the line above solve the issue?

Nope.. it's creating another errors:

[0] *WARNING in ./~/ajv/lib/async.js*

*[0]* Critical dependencies:

[0] 96:20-33 the request of a dependency is an expression

[0] 119:15-28 the request of a dependency is an expression

[0]  @ ./~/ajv/lib/async.js 96:20-33 119:15-28

[0]

[0] *WARNING in ./~/ajv/lib/compile/index.js*

*[0]* Critical dependencies:

[0] 13:21-34 the request of a dependency is an expression

[0]  @ ./~/ajv/lib/compile/index.js 13:21-34

[0]

[0] *WARNING in ./~/ajv/lib/ajv.d.ts*

*[0]* Module parse failed: /home/vagrant/sites/
account-local.metartnetwork.com/node_modules/ajv/lib/ajv.d.ts Unexpected
token (1:8)

[0] You may need an appropriate loader to handle this file type.

[0] SyntaxError: Unexpected token (1:8)

[0]     at Parser.pp$4.raise (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:2221:15)

[0]     at Parser.pp.unexpected (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:603:10)

[0]     at Parser.pp.semicolon (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:581:61)

[0]     at Parser.pp$1.parseExpressionStatement (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:966:10)

[0]     at Parser.pp$1.parseStatement (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:730:24)

[0]     at Parser.pp$1.parseTopLevel (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:638:25)

[0]     at Parser.parse (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:516:17)

[0]     at Object.parse (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:3098:39)

[0]     at Parser.parse (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/webpack/lib/Parser.js:902:15)

[0]     at DependenciesBlock.<anonymous> (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/webpack/lib/NormalModule.js:104:16
)

[0]  @ ./~/ajv/lib ^\.\/.*$

[0]

[0] *WARNING in ./~/ajv/lib/dot/_limitProperties.jst*

*[0]* Module parse failed: /home/vagrant/sites/
account-local.metartnetwork.com/node_modules/ajv/lib/dot/_limitProperties.jst
Unexpected character '#' (1:2)

[0] You may need an appropriate loader to handle this file type.

[0] SyntaxError: Unexpected character '#' (1:2)

[0]     at Parser.pp$4.raise (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:2221:15)

[0]     at Parser.pp$7.getTokenFromCode (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:2756:10)

[0]     at Parser.pp$7.readToken (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:2477:17)

[0]     at Parser.pp$7.nextToken (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:2468:15)

[0]     at Parser.pp$7.next (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:2413:10)

[0]     at Parser.pp.eat (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:536:12)

[0]     at Parser.pp.expect (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:597:10)

[0]     at Parser.pp$1.parseBlock (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:979:10)

[0]     at Parser.pp$1.parseStatement (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:709:33)

[0]     at Parser.pp$1.parseBlock (/home/vagrant/sites/
account-local.metartnetwork.com/node_modules/acorn/dist/acorn.js:981:25)

[0]  @ ./~/ajv/lib ^\.\/.*$

this is not the full errors, but it's small part of it.

I think it's should be the very top priority of this project to fit modern
build modules.

On Sun, Jan 22, 2017 at 8:37 PM, Evgeny Poberezkin <[email protected]

wrote:

Does removing the line above solve the issue?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/epoberezkin/ajv/issues/373#issuecomment-274349497,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AB5hbRPHwnB6EOqgYD3kevTyDaJmj3QMks5rU6IDgaJpZM4LJEhM
.

--
Best Regards,
Idan Gozlan, +972542251188.

P Please consider the environment before printing this email.

@idangozlan I think you are using 4.x.x rather than beta version (5.0.1-beta). These optional dependencies are only removed in beta version, it won't be changed in 4.x.x.

Why webpack is trying to parse .jst files I have no idea - they are not required

hi guys,
I am having the same issue with webpack, it seems to be trying to parse jst files, as webpack attempts to parse all files in the require.
Is there any way around this?

It's not the same problem really, it's webpack configuration issue - how to make it to ignore everything but js (or just ignore jst)

Webpack cant also ignore these files as they will be needed, probably loading them into
I know its not really ajv fault for having this config issue, its just another one webpack issues however i hoped that @idangozlan maybe found a way around this, as i really haven't got time to do a jst loader for webpack, and i wanted to keep using ajv, thats all. As it stands i cant find a loader that will automatically load jst files in webpack, and that stops me from using ajv.

They are not used at run-time so they need to be ignored in webpack.

Upgraded ajv to v5 and the errors went away. Thanks!

Was this page helpful?
0 / 5 - 0 ratings