Webpack: “there are multiple modules with names that only differ in casing” but modules referenced are identical

后端 未结 23 1037
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-30 02:08

I\'m using webpack 3.8.1 and am receiving several instances of the following build warning:

WARNING in ./src/Components/NavBar/MainMenuItemMobile.js
There a         


        
相关标签:
23条回答
  • 2020-11-30 02:31

    We run react on Windows and one of my developers saw this, but no one else had the issue.

    I watched them open VS Code to a sub directory of the project, then did a cd to the project directory with lowercase (instead of the actual mixed case), then run npm start.

    You could actually see the directory name in lowercase in the terminal as c:\someproject\somedir but in Windows explorer it is c:\SomeProject\SomeDir.

    I was surprised the Windows command terminal allows you to do this.

    0 讨论(0)
  • 2020-11-30 02:32

    If you are using VS Code & you are doing "npm run dev" but that respective project folder isn't opened in VS Code then these 3 warnings will occur.

    So the solution is: First open the respective project folder then only do "npm run dev"

    0 讨论(0)
  • 2020-11-30 02:34

    this issue happens to me when I try to run npm start in vscode terminal on window machine. and the issue was /desktop/flatsome instead /Desktop/flatsome just change the path to Desktop with a capital D instead desktop with lowercase d in your vscode terminal

    0 讨论(0)
  • 2020-11-30 02:34

    Yes this happens if you use have used the same name but with case changed: for example, you have used

    import React from 'React';
    

    Instead of:

    import React from 'react';
    
    0 讨论(0)
  • 2020-11-30 02:35

    OMG I finally found the solution to my problem.

    I am using the VS Code Terminal and it was using desktop instead of Desktop in the path of the prompt:

    C:\Users\Hans\desktop\NODE JS\mysite>
    

    To fix it, I just had to close the project folder and reopen it:

    File -> Close Folder
    File -> Open Folder
    

    And now the VS Code Terminal is using the correct prompt path.

    0 讨论(0)
  • 2020-11-30 02:35

    If you are seeing this in Visual Studio Code and Gitbash, go to settings, and search for C:\ (uppercase C) and change the path for the Gitbash.exe to c:\ and it will go away.

    0 讨论(0)
提交回复
热议问题