hapijs / joi

The most powerful data validation library for JS
Other
20.95k stars 1.51k forks source link

Cannot find module '@hapi/hoek/assert' from '../../node_modules/joi/lib/index.js' #2911

Closed mzyil closed 1 year ago

mzyil commented 1 year ago

Support plan

Context

What are you trying to achieve or the steps to reproduce?

Here is the comment that points to the exact line: https://github.com/hapijs/joi/pull/2909/files#r1111330145

irrelevant

What was the result you got?

Cannot find module '@hapi/hoek/assert' from '../../node_modules/joi/lib/index.js'

What result did you expect?

no import errors

mzyil commented 1 year ago

manually running npm install joi@17.7.1 at our own package solved the issue for now. thankfully our direct dependency listed this package as ^17.4.0

Marsup commented 1 year ago

Make sure that @hapi/hoek@11.0.2 is installed and that you are not overriding its version.

mzyil commented 1 year ago

I can verify that the installed version of @hapi/hoek is indeed 11.0.2 but I still get the error. I should mention that the error comes up only when running the unit tests through jest. I also tried these and they worked: resim

resim

it's possible this is because of my jest configuration. closing this for now since the node runtime works, for some reason.

GiovannyRamirez commented 1 year ago

I have same problem.

ipenywis commented 1 year ago

I have the same issue as @mzyil. When I require(@hapi/require/assert) using node REPL. It works but when being used through jest it fails!

clopezpro commented 1 year ago

I have the same problem using nuxt 3 in production mode image

yongjie-zhang-mail commented 1 year ago

我在生产模式下使用 nuxt 3 时遇到了同样的问题 图像

Have you resolved this issue? I'm encountering the same problem with Nuxt 3.7.4, Joi 17.11.0, and Node.js 18.15.0.

cyberstorm2007 commented 1 year ago

image

Is this forever mystery?

clopezpro commented 1 year ago

我在生产模式下使用 nuxt 3 时遇到了同样的问题 图像

Have you resolved this issue? I'm encountering the same problem with Nuxt 3.7.4, Joi 17.11.0, and Node.js 18.15.0.

yes, this way, when using nuxt https://github.com/nuxt/nuxt/discussions/23065

clopezpro commented 1 year ago

image

Is this forever mystery?

If you use Nuxt check this https://github.com/nuxt/nuxt/discussions/23065