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

[request error] [unhandled] [500] Cannot find module ' F:\project-lmq\learn-self-study\bingo-book\j-book-demo\.output\server\chunks\login.post.mjs #2971

Open
lmq352489099 opened this issue Aug 4, 2023 · 3 comments
Labels
support Questions, discussions, and general support

Comments

@lmq352489099
Copy link

I used it while developing the environment and reported this error once I packaged it for access
[nuxt] [request error] [unhandled] [500] 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

@lmq352489099 lmq352489099 added the support Questions, discussions, and general support label Aug 4, 2023
@lmq352489099 lmq352489099 changed the title [request error] [unhandled] [500] 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 [request error] [unhandled] [500] Cannot find module ' F:\project-lmq\learn-self-study\bingo-book\j-book-demo\.output\server\chunks\login.post.mjs Aug 4, 2023
@sonukumar7258
Copy link

The error you're encountering seems to be related to a missing or improperly installed module, specifically @hapi/hoek and its assert submodule. This can happen when there's a discrepancy between the installed packages or the paths being used.

To troubleshoot this issue, you can try the following steps:

Clear node_modules and Reinstall Dependencies: Sometimes, issues like this can arise due to corrupted or mismatched dependencies. You can try removing the node_modules directory and the package-lock.json or yarn.lock file, then running npm install or yarn install again to reinstall all dependencies.

# Delete node_modules and lock files
rm -rf node_modules package-lock.json yarn.lock
# Reinstall dependencies
npm install
# or
yarn install

Update Nuxt and Dependencies: Make sure you're using the latest version of Nuxt.js and other relevant dependencies. You can update Nuxt by running:

npm update nuxt
# or
yarn upgrade nuxt

Check Module Paths: Verify that the paths to your modules are correct in your application. It seems like the error message is mentioning a path in the .output directory, which might be related to your build or output configuration. Make sure that your build setup is correct and the paths are being resolved properly.

Check Import Statements: Ensure that your import statements in your code are using the correct paths to import modules. Double-check that you're not accidentally using relative paths that might cause confusion.

Check Webpack or Build Configuration: If you're using a custom webpack or build configuration in your Nuxt.js project, make sure that it's correctly set up. Any issues with the build process might lead to errors like the one you're encountering.

Check Package Versions: If the issue persists, it's possible that there might be compatibility issues between different packages. Make sure that your package.json file lists compatible versions of your dependencies.

If none of these steps resolve the issue, consider providing more context about your project's directory structure, your Nuxt.js configuration, and any customizations you've made to the build process. This additional information could help in diagnosing the problem more accurately.

@sonukumar7258
Copy link

and if issue will not be resolved by these default corrections, please give me more information, i will check that out too and hopefully your issue will be resolved

@yongjie-zhang-mail
Copy link

I had the same problem
nuxt3 package.json

 "devDependencies": {
    "@ant-design-vue/nuxt": "^1.1.1",
    "@nuxt/devtools": "latest",
    "@types/crypto-js": "^4.1.2",
    "@types/jsonwebtoken": "^9.0.3",
    "less": "^4.2.0",
    "nuxt": "^3.7.1",
    "sequelize-auto": "^0.8.8"
  },
  "dependencies": {
    "@pinia-plugin-persistedstate/nuxt": "^1.1.1",
    "@pinia/nuxt": "^0.4.11",
    "ant-design-vue": "^4.0.2",
    "crypto-js": "^4.1.1",
    "joi": "^17.11.0",
    "jsonwebtoken": "^9.0.2",
    "moment": "^2.29.4",
    "mysql2": "^3.6.1",
    "pinia": "^2.1.6",
    "sequelize": "^6.33.0"
  },
  "overrides": {
    "vue": "latest"
  }

server/api/user/index.get.ts

import Joi from 'joi';
export default defineEventHandler(async (event) => {
  const query = getQuery(event);

  try {
    const schema = Joi.object({
      id: validate.number().required().label("params.id"),
    });
    await schema.validateAsync(query);
  } catch (error) {
    return sendError(event, createError({ statusCode: 422, data: error }))
  }

  return query
});

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

3 participants