简体   繁体   English

“找不到模块问题”

[英]'Module Not Found Issue'

There is an issue in my Project and stating 'Cannot find module ' after several attempts and I am trying to install and uninstall the packages simultaneously, the issue is not resolving.我的项目中存在问题,并在多次尝试后显示“无法找到模块”,我尝试同时安装和卸载软件包,但问题并未解决。 这是我的 package.json 文件的代码:-

{
      "name": "tooling-01-starting-project",
      "version": "1.0.0",
      "description": "JavaScript The Complete Guide",
      "main": "eslint.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "build": "webpack"
      },
      "author": "Junaid Jawed",
      "license": "ISC",
      "devDependencies": {
        "eslint": "^7.32.0",
        "webpack": "^5.53.0",
        "webpack-cli": "^4.8.0",
        "webpack-dev-server": "^4.2.1"
      },
      "dependencies": {
        "grunt": "^1.4.1"
      }

} }

Below this is my webpack.config.js file coding:-下面是我的 webpack.config.js 文件编码:-

 /* eslint-disable no-undef */
const path = require('path');

module.exports =
{
    entry:'./src/app.js',
    output:
    {
        filename:'app.js',
        path:path.resolve(__dirname,'assets','scripts')
    }

};

    const path2 = require('path');
    
    module.exports =
    {
        entry:'./node_modules/webpack/bin/webpack.js',
        output:
        {
            filename:'webpack.js',
            path2:path2.resolve(__dirname,'webpack','bin')
        }
    
    };
     

Also above I have attached an screenshot of my error in npm command prompt:-同样在上面,我在 npm 命令提示符中附上了我的错误截图:-

Can somebody tell me what is the problem of this issue?有人可以告诉我这个问题的问题是什么吗? I think it doesn't found the file location where my webpack.js file is located.我认为它没有找到我的 webpack.js 文件所在的文件位置。

I've been stuck with that kind of issues for times in the past.过去,我曾多次遇到此类问题。

One thing that it could be, is about the project location.可能的一件事是关于项目位置。 Here it is said that's in E:\ , try to relocate it in C:\Users\YourUser\Documents\MyProject and do the following:这里据说在E:\中,尝试将其重新定位在C:\Users\YourUser\Documents\MyProject中并执行以下操作:

Run npm i command, and start the solution.运行npm i命令,并启动解决方案。 If it doesn't work, could be an issue regarding the version of node that's installed in your computer...如果它不起作用,可能是关于您计算机中安装的节点版本的问题......

I have faced the same problem.我遇到了同样的问题。 To solve this just add "type": "module" in your package.json file and you are good to go!要解决这个问题,只需在package.json文件中添加"type": "module"即可!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 webpack 模块未找到问题 - webpack Module not found issue 未找到反应模块 - 无法解决问题 - React module not found - Unable to resolve issue 节点模块时间戳记问题“找不到命令” - Issue with node module timestampnotes “command not found” 找不到节点模块。找不到模块 - node module not found .MODULE NOT FOUND 找不到模块:错误:无法解析模块“组件/应用程序”。 webpack + reactjs 问题 - Module not found: Error: Cannot resolve module 'components/app'. webpack + reactjs issue react 或 npm 问题:找不到模块:[CaseSensitivePathsPlugin] `...\react.js` 与磁盘上的相应路径不匹配`react` - react or npm issue: Module not found: [CaseSensitivePathsPlugin] `...\react.js` does not match the corresponding path on disk `react` React native / node 问题:成功找到 package。 但是,package 指定了一个无法解析的“主”模块字段 - React native / node issue: The package was successfully found. However, the package specifies a `main` module field that could not be resolved 使用rekuire,requirish或rfr解决Node.js时找不到模块 - Module not found when using rekuire, requirish, or rfr to solve nodejs require relative issue 第一个 NodeJS 应用程序 - 如何解决 MODULE NOT FOUND 和其他问题? - First NodeJS Application - How do I resolve MODULE NOT FOUND, and other issue? 将模块注入角度作为未找到的模块 - Injecting a module into angular as module not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM