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

Module not found: Can't resolve 'date-fns' #3746

Open
todddenmar opened this issue Mar 27, 2024 · 1 comment
Open

Module not found: Can't resolve 'date-fns' #3746

todddenmar opened this issue Mar 27, 2024 · 1 comment

Comments

@todddenmar
Copy link

todddenmar commented Mar 27, 2024

 "dependencies": {
    "@radix-ui/react-accordion": "^1.1.2",
    "@radix-ui/react-avatar": "^1.0.4",
    "@radix-ui/react-dialog": "^1.0.5",
    "@radix-ui/react-dropdown-menu": "^2.0.6",
    "@radix-ui/react-navigation-menu": "^1.1.4",
    "@radix-ui/react-popover": "^1.0.7",
    "@radix-ui/react-scroll-area": "^1.0.5",
    "@radix-ui/react-select": "^2.0.0",
    "@radix-ui/react-separator": "^1.0.3",
    "@radix-ui/react-slot": "^1.0.2",
    "@radix-ui/react-switch": "^1.0.3",
    "@radix-ui/react-tabs": "^1.0.4",
    "@radix-ui/react-tooltip": "^1.0.7",
    "@sanity/image-url": "^1.0.2",
    "@sanity/vision": "^3.34.0",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.0",
    "cmdk": "^1.0.0",
    "date-fns": "^3.6.0",
    "embla-carousel-react": "^8.0.0",
    "firebase": "^10.8.1",
    "lodash": "^4.17.21",
    "lucide-react": "^0.352.0",
    "moment": "^2.30.1",
    "next": "14.1.3",
    "next-sanity": "^7.1.4",
    "next-themes": "^0.2.1",
    "react": "^18",
    "react-day-picker": "^8.10.0",
    "react-dom": "^18",
    "sanity": "^3.36.0",
    "sonner": "^1.4.3",
    "styled-components": "^6.1.8",
    "swiper": "^11.0.7",
    "tailwind-merge": "^2.2.1",
    "tailwindcss-animate": "^1.0.7",
    "uuid": "^9.0.1",
    "vaul": "^0.9.0",
    "zustand": "^4.5.2"
  },
  "devDependencies": {
    "@types/date-fns": "^2.6.0",
    "autoprefixer": "^10.0.1",
    "postcss": "^8",
    "tailwindcss": "^3.3.0"
  }


./node_modules/react-day-picker/dist/index.esm.js:2:0
Module not found: Can't resolve 'date-fns'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./components/ui/calendar.jsx
./components/OrderCalendar.js
./components/CurrentOrderCard.js
./components/point-of-sale/OrdersButton.js
./components/NavigationBar.js
./app/layout.js

error occured when im on my project clone, when I remove the calendar component, it still has error on the sanity studio

./node_modules/sanity/lib/_chunks-es/StructureToolProvider.js:62:0
Module not found: Can't resolve 'date-fns'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/sanity/lib/structure.esm.js
./sanity.config.js
./app/studio/[[...index]]/page.jsx

@fturmel
Copy link
Member

fturmel commented Mar 31, 2024

No idea what's going on here. Does the "node_modules/date-fns" directory/symlink even exist in your project? I would start by deleting you node_modules directory and the lock file, and then reinstall your dependencies. Maybe clean your dependency manager's global cache in case that got corrupted.

If you can create a simple reproduction repo, I can have a look.

Noticed two things though:

  1. "@types/date-fns" is not a thing, date-fns ships its own types. You can remove this dependency.
  2. Sanity seems to still use v2 of date-fns, so that could potentially mess some things up for you (yet it's unlikely that it would cause a "module not found" error). Perhaps the discussion in Error TS2614: Module has no exported member #3747 could help.

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

No branches or pull requests

2 participants