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 on 3.1.0 #20

Closed
matijuguera opened this issue May 31, 2023 · 4 comments · Fixed by #21
Closed

Cannot find module on 3.1.0 #20

matijuguera opened this issue May 31, 2023 · 4 comments · Fixed by #21

Comments

@matijuguera
Copy link

matijuguera commented May 31, 2023

`error - Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/m/Documents/Packagetome/node_modules/use-breakpoint/dist/esm/createMediaQueries' imported from /home/m/Documents/Packagetome/node_modules/use-breakpoint/dist/esm/getCSSMediaQueries.js
    at new NodeError (node:internal/errors:400:5)
    at finalizeResolution (node:internal/modules/esm/resolve:260:11)
    at moduleResolve (node:internal/modules/esm/resolve:879:10)
    at defaultResolve (node:internal/modules/esm/resolve:1087:11)
    at nextResolve (node:internal/modules/esm/loader:161:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:834:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:415:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
    at link (node:internal/modules/esm/module_job:76:36) {
  digest: undefined
} `
`{
  packagetome: '0.1.0',
  npm: '9.2.0',
  node: '19.3.0',
  v8: '10.8.168.21-node.8',
  uv: '1.44.2',
  zlib: '1.2.13',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '111',
  nghttp2: '1.51.0',
  napi: '8',
  llhttp: '8.1.0',
  uvwasi: '0.0.13',
  openssl: '3.0.7+quic',
  cldr: '42.0',
  icu: '72.1',
  tz: '2022f',
  unicode: '15.0',
  ngtcp2: '0.8.1',
  nghttp3: '0.7.0'
}`

image

@marcosb74
Copy link

Hello, that happens because Vercel is caseSensitive and the module it's trying to find is getCSSMediaQueries, hence it can not find it. Here's the article:

https://vercel.com/guides/how-do-i-resolve-a-module-not-found-error

@ConcernedHobbit
Copy link
Contributor

The issue originates on line 2 of getCSSMediaQueries, it does not have .js extension and the import resolution is failed due to this

import createMediaQueries from './createMediaQueries'

@ConcernedHobbit
Copy link
Contributor

styleguide gave a more verbose error message that helped track down the issue;

Module not found: Error: Can't resolve './createMediaQueries' in '/[snip]/.pnpm/use-breakpoint@3.1.0_react-dom@18.2.0_react@18.2.0/node_modules/use-breakpoint/dist/esm'
Did you mean 'createMediaQueries.js'?
BREAKING CHANGE: The request './createMediaQueries' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

@iiroj iiroj closed this as completed in #21 Jun 1, 2023
iiroj pushed a commit that referenced this issue Jun 1, 2023
iiroj pushed a commit that referenced this issue Jun 1, 2023
## [3.1.1](v3.1.0...v3.1.1) (2023-06-01)

### Bug Fixes

* add missing file extension to imports ([#21](#21)) ([d3f0c21](d3f0c21)), closes [#20](#20)
@iiroj
Copy link
Owner

iiroj commented Jun 1, 2023

🎉 This issue has been resolved in version 3.1.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants