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

Cannot find module '@hapi/hoek/assert' from 'index.js' #2917

Closed
sagarpanda opened this issue Feb 21, 2023 · 8 comments
Closed

Cannot find module '@hapi/hoek/assert' from 'index.js' #2917

sagarpanda opened this issue Feb 21, 2023 · 8 comments
Assignees
Labels
support Questions, discussions, and general support
Milestone

Comments

@sagarpanda
Copy link

sagarpanda commented Feb 21, 2023

Support plan

  • is this issue currently blocking your project? (yes/no): Yes
  • is this issue affecting a production system? (yes/no): Yes

Context

  • node version: 16.18.1
  • module version with issue: 17.18.1
  • last module version without issue: 17.7.0
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): joi
  • any other relevant information: It seems, const Assert = require('@hapi/hoek/assert'); does not work for nodejs v16.18.1

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

import Joi from "joi";

 const schema = Joi.object({
    items: Joi.array().required(),
    skip: Joi.boolean()
 });

What was the result you got?

    Cannot find module '@hapi/hoek/assert' from 'index.js'
      at Resolver.resolveModule (../../node_modules/jest-resolve/build/index.js:259:17)
      at Object.<anonymous> (../../node_modules/joi/lib/index.js:3:16)

What result did you expect?

This should not throw any error.

Screenshot 2023-02-21 at 1 26 40 PM

@sagarpanda sagarpanda added the support Questions, discussions, and general support label Feb 21, 2023
@priyanshuchauhan
Copy link

@sagarpanda
Are you using node v12 ?
Updating to node v14 worked for me

@Marsup Marsup self-assigned this Feb 21, 2023
@Marsup Marsup added this to the 17.8.3 milestone Feb 21, 2023
@Marsup
Copy link
Collaborator

Marsup commented Feb 21, 2023

I have reverted everything in 17.8.3 (see #2914), but indeed expect that for the next major version. You are either using an old node or an old jest.

@Marsup Marsup closed this as completed Feb 21, 2023
@sagarpanda
Copy link
Author

Thanks @Marsup

@lmq352489099
Copy link

"joi": "^17.9.1"  Is that a problem ?  
 
 
  "dependencies": {
    "@bytemd/plugin-gfm": "^1.21.0",
    "@bytemd/plugin-highlight": "^1.21.0",
    "@bytemd/vue-next": "^1.21.0",
    "@iconify/json": "^2.2.44",
    "@pinia-plugin-persistedstate/nuxt": "^1.1.1",
    "@pinia/nuxt": "^0.4.7",
    "ant-design-vue": "^3.2.15",
    "cos-js-sdk-v5": "^1.4.16",
    "cos-nodejs-sdk-v5": "^2.11.19",
    "joi": "^17.9.1",
    "jsonwebtoken": "^9.0.0",
    "less": "^4.1.3",
    "md5": "^2.3.0",
    "moment": "^2.29.4",
    "mysql2": "^3.2.0",
    "pinia": "^2.0.33",
    "qcloud-cos-sts": "^3.1.0",
    "sass": "^1.60.0",
    "unplugin-icons": "^0.16.1",
    "unplugin-vue-components": "^0.24.1",
    "uuid": "^9.0.0"
  }


{
    "url": "/api/auth/login",
    "statusCode": 500,
    "statusMessage": "",
    "message": "Cannot find module 'F:\\project-lmq\\learn-self-study\\bingo-book\\j-book-demo\\.output\\server\\node_modules\\@hapi\\hoek\\lib\\assert' imported from F:\\project-lmq\\learn-self-study\\bingo-book\\j-book-demo\\.output\\server\\chunks\\login.post.mjs\nDid you mean to import @hapi/hoek/lib/assert.js?",
    "stack": ""
}

@Marsup
Copy link
Collaborator

Marsup commented Aug 4, 2023

It shouldn't be, if you're still having problems, maybe your lockfile is keeping old versions of things, then try to remove and re-add joi.

@clopezpro
Copy link

"joi": "^17.9.1"  Is that a problem ?  
 
 
  "dependencies": {
    "@bytemd/plugin-gfm": "^1.21.0",
    "@bytemd/plugin-highlight": "^1.21.0",
    "@bytemd/vue-next": "^1.21.0",
    "@iconify/json": "^2.2.44",
    "@pinia-plugin-persistedstate/nuxt": "^1.1.1",
    "@pinia/nuxt": "^0.4.7",
    "ant-design-vue": "^3.2.15",
    "cos-js-sdk-v5": "^1.4.16",
    "cos-nodejs-sdk-v5": "^2.11.19",
    "joi": "^17.9.1",
    "jsonwebtoken": "^9.0.0",
    "less": "^4.1.3",
    "md5": "^2.3.0",
    "moment": "^2.29.4",
    "mysql2": "^3.2.0",
    "pinia": "^2.0.33",
    "qcloud-cos-sts": "^3.1.0",
    "sass": "^1.60.0",
    "unplugin-icons": "^0.16.1",
    "unplugin-vue-components": "^0.24.1",
    "uuid": "^9.0.0"
  }


{
    "url": "/api/auth/login",
    "statusCode": 500,
    "statusMessage": "",
    "message": "Cannot find module 'F:\\project-lmq\\learn-self-study\\bingo-book\\j-book-demo\\.output\\server\\node_modules\\@hapi\\hoek\\lib\\assert' imported from F:\\project-lmq\\learn-self-study\\bingo-book\\j-book-demo\\.output\\server\\chunks\\login.post.mjs\nDid you mean to import @hapi/hoek/lib/assert.js?",
    "stack": ""
}

I HAVE "joi": "^17.9.2", and i have the same problem

image

"Cannot find module 'G:\\cotizador\\.output\\server\\node_modules\\@hapi\\hoek\\lib\\assert' imported from G:\\cotizador\\.output\\server\\chunks\\register.post.mjs\nDid you mean to import @hapi/hoek/lib/assert.js?"

I use Nuxt 3.7.0 with Node.js version: 18.5.0 this is in production

@yongjie-zhang-mail
Copy link

"joi": "^17.9.1"  Is that a problem ?  
 
 
  "dependencies": {
    "@bytemd/plugin-gfm": "^1.21.0",
    "@bytemd/plugin-highlight": "^1.21.0",
    "@bytemd/vue-next": "^1.21.0",
    "@iconify/json": "^2.2.44",
    "@pinia-plugin-persistedstate/nuxt": "^1.1.1",
    "@pinia/nuxt": "^0.4.7",
    "ant-design-vue": "^3.2.15",
    "cos-js-sdk-v5": "^1.4.16",
    "cos-nodejs-sdk-v5": "^2.11.19",
    "joi": "^17.9.1",
    "jsonwebtoken": "^9.0.0",
    "less": "^4.1.3",
    "md5": "^2.3.0",
    "moment": "^2.29.4",
    "mysql2": "^3.2.0",
    "pinia": "^2.0.33",
    "qcloud-cos-sts": "^3.1.0",
    "sass": "^1.60.0",
    "unplugin-icons": "^0.16.1",
    "unplugin-vue-components": "^0.24.1",
    "uuid": "^9.0.0"
  }


{
    "url": "/api/auth/login",
    "statusCode": 500,
    "statusMessage": "",
    "message": "Cannot find module 'F:\\project-lmq\\learn-self-study\\bingo-book\\j-book-demo\\.output\\server\\node_modules\\@hapi\\hoek\\lib\\assert' imported from F:\\project-lmq\\learn-self-study\\bingo-book\\j-book-demo\\.output\\server\\chunks\\login.post.mjs\nDid you mean to import @hapi/hoek/lib/assert.js?",
    "stack": ""
}

我有,我有同样的问题"joi": "^17.9.2",

图像

"Cannot find module 'G:\\cotizador\\.output\\server\\node_modules\\@hapi\\hoek\\lib\\assert' imported from G:\\cotizador\\.output\\server\\chunks\\register.post.mjs\nDid you mean to import @hapi/hoek/lib/assert.js?"

我将Nuxt 3.7.0与Node一起使用.js版本:18.5.0,这是在生产中

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.

@clopezpro
Copy link

"joi": "^17.9.1"  Is that a problem ?  
 
 
  "dependencies": {
    "@bytemd/plugin-gfm": "^1.21.0",
    "@bytemd/plugin-highlight": "^1.21.0",
    "@bytemd/vue-next": "^1.21.0",
    "@iconify/json": "^2.2.44",
    "@pinia-plugin-persistedstate/nuxt": "^1.1.1",
    "@pinia/nuxt": "^0.4.7",
    "ant-design-vue": "^3.2.15",
    "cos-js-sdk-v5": "^1.4.16",
    "cos-nodejs-sdk-v5": "^2.11.19",
    "joi": "^17.9.1",
    "jsonwebtoken": "^9.0.0",
    "less": "^4.1.3",
    "md5": "^2.3.0",
    "moment": "^2.29.4",
    "mysql2": "^3.2.0",
    "pinia": "^2.0.33",
    "qcloud-cos-sts": "^3.1.0",
    "sass": "^1.60.0",
    "unplugin-icons": "^0.16.1",
    "unplugin-vue-components": "^0.24.1",
    "uuid": "^9.0.0"
  }


{
    "url": "/api/auth/login",
    "statusCode": 500,
    "statusMessage": "",
    "message": "Cannot find module 'F:\\project-lmq\\learn-self-study\\bingo-book\\j-book-demo\\.output\\server\\node_modules\\@hapi\\hoek\\lib\\assert' imported from F:\\project-lmq\\learn-self-study\\bingo-book\\j-book-demo\\.output\\server\\chunks\\login.post.mjs\nDid you mean to import @hapi/hoek/lib/assert.js?",
    "stack": ""
}

我有,我有同样的问题"joi": "^17.9.2",
图像
"Cannot find module 'G:\\cotizador\\.output\\server\\node_modules\\@hapi\\hoek\\lib\\assert' imported from G:\\cotizador\\.output\\server\\chunks\\register.post.mjs\nDid you mean to import @hapi/hoek/lib/assert.js?"
我将Nuxt 3.7.0与Node一起使用.js版本:18.5.0,这是在生产中

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, I did it with this

nuxt/nuxt#23065 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Questions, discussions, and general support
Projects
None yet
Development

No branches or pull requests

6 participants