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

Multiple modules with names that only differ in casing in Popper module. #14711

Closed
mlyngvo opened this issue Mar 1, 2019 · 17 comments
Closed
Labels
component: Popper The React component. See <Popup> for the latest version. status: waiting for author Issue with insufficient information v4.x

Comments

@mlyngvo
Copy link

mlyngvo commented Mar 1, 2019

In material-ui/Popper.js, maybe considering using a different approach on importing the popper.js to Popper component. My webpack compiler reports it as follow:

WARNING in ./node_modules/@material-ui/core/Popper/Popper.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* /Users/iohl/Documents/Workspace/Public/VARIOLOGIC/sysops_pool/node_modules/@material-ui/core/Popper/Popper.js
    Used by 1 module(s), i. e.
    /Users/iohl/Documents/Workspace/Public/VARIOLOGIC/sysops_pool/node_modules/@material-ui/core/Popper/index.js
* /Users/iohl/Documents/Workspace/Public/VARIOLOGIC/sysops_pool/node_modules/@material-ui/core/Popper/popper.js
    Used by 2 module(s), i. e.
    /Users/iohl/Documents/Workspace/Public/VARIOLOGIC/sysops_pool/node_modules/@material-ui/core/Popper/Popper.js
...

Solution

A temporally fix for this issue is to use either an absolute or relative path that point directly to popper.js file when require the library.

See #14711 (comment)

@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 2, 2019

@iohl What version of Material-UI are you using? The unpkg archive looks clean: https://unpkg.com/@material-ui/[email protected]/Popper/. Any idea how we can reproduce the problem?

@mlyngvo
Copy link
Author

mlyngvo commented Mar 5, 2019

I think it's a duplicate of #11281. So we can close this issue.

@hatton
Copy link

hatton commented May 18, 2019

I am having this problem with@material-ui/core": "^4.0.0-beta.2" and webpack 4.31.0.

WARNING in ./node_modules/@material-ui/core/esm/Popper/Popper.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* C:\dev\b46\src\BloomBrowserUI\node_modules\@material-ui\core\esm\Popper\Popper.js
    Used by 2 module(s), i. e.
    C:\dev\b46\src\BloomBrowserUI\node_modules\@material-ui\core\esm\Popper\index.js
* C:\dev\b46\src\BloomBrowserUI\node_modules\@material-ui\core\esm\Popper\popper.js
    Used by 4 module(s), i. e.
    C:\dev\b46\src\BloomBrowserUI\node_modules\@material-ui\core\esm\Popper\Popper.js

@oliviertassinari
Copy link
Member

@hatton How can we reproduce it?

@hatton
Copy link

hatton commented May 18, 2019

Olivier thanks for looking into this.

How can we reproduce it?

Well, if it is somehow related to having a large-ish bundle sizes as IoHL seemed to imply, you could build the project I'm working on. I have tested this only on windows, but with both Cmd and Bash shells.

git clone -b newPublishScreens  https://github.com/hatton/BloomDesktop.git
cd BloomDesktop/src/BloomBrowserUI

(requires node 10.15.3)

yarn
yarn webpack

@joshwooding
Copy link
Member

joshwooding commented May 18, 2019

I can't reproduce it on PowerShell or GitBash. (Windows 10)

@hatton
Copy link

hatton commented May 18, 2019

Edit: Sorry, getting sloppy... I need to come back to this next week.

@mayacode
Copy link

I have exactly the same.

WARNING in ./node_modules/@material-ui/core/Popper/Popper.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* node_modules/@material-ui/core/Popper/Popper.js
    Used by 1 module(s), i. e.
    node_modules/@material-ui/core/Popper/index.js
* node_modules/@material-ui/core/Popper/popper.js
    Used by 2 module(s), i. e.
    node_modules/@material-ui/core/Popper/Popper.js

The problem exists on OSes for which file names are case insensitive like macos.

hally9k added a commit to hally9k/material-ui that referenced this issue Jun 17, 2019
@mationai
Copy link

mationai commented Nov 8, 2019

Still seeing the issue after rm -rf node_modules/@material-ui/core and npm i @material-ui/[email protected] :

There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* /path/node_modules/@material-ui/core/esm/Popper/Popper.js
    Used by 2 module(s), i. e.
    /path/node_modules/@material-ui/core/esm/Popper/index.js
* /path/node_modules/@material-ui/core/esm/Popper/popper.js
    Used by 4 module(s), i. e.
    /path/node_modules/@material-ui/core/esm/Popper/Popper.js

OS: mac

@OssiPesonen
Copy link

OssiPesonen commented Jan 9, 2020

What I basically did wa,s we have create-react-app where we've exported the configuration.

I installed:

  • Storybook
  • Material UI
  • Styled components

I attempted to get Material UI working on Storybook with multiple themes, and a theme provider with a dynamic switcher, according to this article: https://medium.com/encode/setting-up-storybook-with-material-ui-and-styled-components-5bdacb6db866

I cannot get the storybook stories to print. It's a separate issues. But if I install react-scripts(which we don't have in our project) I suddenly get this error and it prevents me from building the code.

ERROR in ./node_modules/@material-ui/core/esm/Popper/Popper.js
Module not found: Error: Cannot find file: 'popper.js' does not match the corresponding name on disk: './node_modules/@material-ui/core/esm/Popper/Popper.js'.
 @ ./node_modules/@material-ui/core/esm/Popper/Popper.js 5:0-33 128:21-29
 @ ./node_modules/@material-ui/core/esm/Popper/index.js
 @ ./node_modules/@material-ui/core/esm/Tooltip/Tooltip.js
 @ ./node_modules/@material-ui/core/esm/Tooltip/index.js
 @ ./node_modules/@material-ui/core/esm/index.js
 @ ./src/stories/Welcome.stories.js
 @ ./src/stories sync \.stories\.js$
 @ ./.storybook/config.js
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js (webpack)-hot-middleware/client.js?reload=true&quiet=true

@mlyngvo
Copy link
Author

mlyngvo commented Jan 9, 2020

For those who still has this issue, what i did back then as a work around and still work until now in my project was simply replace the source code import line of popper.js with absolute path to the library file.

I use webpack and here's the config:

return {
   ...,
   module: {
        rules: [
            {
                test: /node_modules\/@material-ui\/core\/esm\/Popper\/Popper\.js$/,
                use: {
                    loader: 'string-replace-loader',
                    options: {
                        search: 'import PopperJS from \'popper.js\';',
                        replace: 'import PopperJS from "../../../../popper.js/dist/esm/popper";'
                    }
                }
            }
        ]
    },
    ...
}

I believe this is, as @mayacode mentioned, an OSes problem so do what you must to get material-ui library on your machine to find and load correctly this popper.js library in order for your code to be built successfully.

@inspiraller
Copy link

hi
I've tried your solution above by implementing this on the storybook.main.js to override webpack as below

module.exports = {
  stories: ['../src/**/*.stories.tsx'],
  addons: [
    '@storybook/preset-create-react-app',
    '@storybook/addon-actions',
    '@storybook/addon-links',
  ],
  webpackFinal: async (config, {configType}) => {
    config.module.rules.push({
       test: /node_modules\/@material-ui\/core\/esm\/Popper\/Popper\.js$/,
       use: {
           loader: 'string-replace-loader',
           options: {
               search: 'import PopperJS from \'popper.js\';',
               replace: 'import PopperJS from "../../../../popper.js/dist/esm/popper";'
           }
       }
    });
    return config;
  }
};

Unfortunately this does nothing and I still get the same error using Material-Table

@Narutuffy
Copy link

Hey guys just commenting to let you know that, I'm still facing this issue

@radoslavkarlik
Copy link

The solution provided by @iohl works but you might need to specify a different separator. This worked for me.
test: /node_modules\\@material-ui\\core\\esm\\Popper\\Popper\.js$/
instead of test: /node_modules\/@material-ui\/core\/esm\/Popper\/Popper\.js$/

@anudeepb28
Copy link

Still relevant in 2021..
I faced the same issue but in version 4.11.x of @material-ui/core, the import name is PopperJs instead of PopperJS. So following worked for me:

options: {
      search: 'import PopperJs from \'popper.js\';',
      replace: 'import PopperJs from "../../../../popper.js/dist/esm/popper";'
}

@poojaSingh18
Copy link

Hello, I am also facing this in 4.12.3. Any idea when permanent fix will be provided ?

@oliviertassinari oliviertassinari added component: Popper The React component. See <Popup> for the latest version. v4.x labels Aug 19, 2021
@mui mui locked as resolved and limited conversation to collaborators Aug 19, 2021
@oliviertassinari
Copy link
Member

@poojaSingh18 It should already be fixed in v5.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: Popper The React component. See <Popup> for the latest version. status: waiting for author Issue with insufficient information v4.x
Projects
None yet
Development

No branches or pull requests