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 'react-datepicker/dist/react-datepicker.css' in v2.9.0 #1882

Closed
hiredgun opened this issue Aug 29, 2019 · 31 comments
Labels

Comments

@hiredgun
Copy link

Describe the bug
Looks like the package folder is missing dist folder after 2.9.0 release causing webpack build to fail due to the missing 'react-datepicker/dist/react-datepicker.css' file

image

To Reproduce
Steps to reproduce the behavior:

Install 2.9.0 version and import 'react-datepicker/dist/react-datepicker.css' file in one of your components

Desktop (please complete the following information):

  • OS: Mac

Additional context
Node: 12.9.0
NPM: 6.10.2

@hiredgun hiredgun changed the title Module not found: Can't resolve 'react-datepicker/dist/react-datepicker.css' Module not found: Can't resolve 'react-datepicker/dist/react-datepicker.css' in v2.9.0 Aug 29, 2019
@thitoo
Copy link

thitoo commented Aug 29, 2019

same here

@srMarquinho
Copy link

srMarquinho commented Aug 29, 2019

Major issue for us atm.
*We are locking to previous.

@martijnrusschen
Copy link
Member

@mxschmitt Any idea what went wrong here. This might be caused by the refactoring of the release process.

@mxschmitt
Copy link
Contributor

@mxschmitt Any idea what went wrong here. This might be caused by the refactoring of the release process.

I guess it it's because of my refactoring. I will investigate now

@tuttiflirty
Copy link

tuttiflirty commented Aug 29, 2019

I'm observing the same issue on @2.0.0 also. I managed to get rid of the problem locally with npm install style-loader css-loader --save but I still have this issue on Circle CI as

yarn run v1.17.3
$ react-scripts build
Creating an optimized production build...
Failed to compile.

Module not found: Error: Can't resolve 'react-datepicker/dist/react-datepicker.css' ...

@JohnLyonJunior
Copy link

same problem on @2.1.0. Hopefully you guys can resolve this)

@junmich
Copy link

junmich commented Aug 29, 2019

same problem here, any fix or workaround that you could recommend? Major issue in our deployment now. I’ll try to use @2.9.0 or the previous version for now

@NwogeEberechi
Copy link

same problem, I am facing the same issue in our deployment

@vitalbadjo
Copy link

Same problem

@ni3k
Copy link

ni3k commented Aug 29, 2019

same problem

@mxschmitt
Copy link
Contributor

I created here a Pr, should fix the build process: #1883

But I'm sorry, I don't have much rollup knowledge :/

@tuttiflirty
Copy link

tuttiflirty commented Aug 29, 2019

Thank you for the patch v2.9.1 @mxschmitt , but it doesn't seem to work for me neither Same error. dist folder is created but remains empty.

@martijnrusschen
Copy link
Member

Can you try this again with v2.9.3?

@tuttiflirty
Copy link

Thx @martijnrusschen ! All working now 💯

@martijnrusschen
Copy link
Member

Fixed by 98fa951. Thanks all!

@flameuzumo
Copy link

This package use to work in meteor.js. I install it using: meteor npm install --save react-datepicker
But now I get an error that references react-datepicker.css, here it is:

`/home/2in/Meteor1.6/meteor10-Hydrate/Atrade/node_modules/react-datepicker/dist/react-datepicker.css:1
(function (exports, require, module, __filename, __dirname) { .react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle, .react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow,
^

SyntaxError: Unexpected token .
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at npmRequire (/home/2in/Meteor1.6/meteor10-Hydrate/Atrade/.meteor/local/build/programs/server/npm-require.js:133:10)
at Module.useNode (packages/modules-runtime.js:664:18)
at react-datepicker.css (packages/modules.js:433:8)
at fileEvaluate (packages/modules-runtime.js:336:7)
at Module.require (packages/modules-runtime.js:238:14)
at Module.moduleLink [as link] (/home/2in/.meteor/packages/modules/.0.13.0.ibssab.6e4t++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/reify/lib/runtime/index.js:38:38)
at SearchPurchaseHistory.jsx (imports/ui/components/SearchPurchaseHistory.jsx:1:226)
at fileEvaluate (packages/modules-runtime.js:336:7)
at Module.require (packages/modules-runtime.js:238:14)
at Module.moduleLink [as link] (/home/2in/.meteor/packages/modules/.0.13.0.ibssab.6e4t++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/reify/lib/runtime/index.js:38:38)
at router.jsx (imports/ui/router.jsx:1:8256)
at fileEvaluate (packages/modules-runtime.js:336:7)
at Module.require (packages/modules-runtime.js:238:14)
Exited with code: 1
Your application is crashing. Waiting for file change.`

Any ideas? Is this a bug?
Is there a react and meteor specific datepicker I can use if this can't be resolved?

@izaakf
Copy link

izaakf commented Dec 2, 2019

getting this error on v2.10.1

@sommesh
Copy link

sommesh commented May 2, 2020

getting the same error on v2.14.1.
Any solutions?

@izaakf
Copy link

izaakf commented May 2, 2020

@sommesh i never came across a stable solution so I moved to a different package unfortunately

@sommesh
Copy link

sommesh commented May 2, 2020

Okay, kindly let me know does that different package has accessibility support?

Anyway, I did a workaround to fix this.
Just moved the file node_modules/react-datepicker/dist/react-datepicker.css to my local src folder and imported it.

@Dror-Bar
Copy link

Dror-Bar commented Jan 5, 2021

@sommesh I used the same solution. css file didn't load after building. Had to move the file to my local src folder and import it from there.

@mxschmitt
Copy link
Contributor

It's weird since its there somehow: https://unpkg.com/react-datepicker@3.3.0/dist/react-datepicker.css

@Dror-Bar
Copy link

Dror-Bar commented Jan 5, 2021

@mxschmitt I'm using version 2.10.0. Could it be related? I didn't want to upgrade yet because 1. I wasn't sure if any breaking changes would affect me 2. I wasn't confident upgrading will fix the bug.
If this bug only happens on versions 2x then I guess it's not a real issue anymore, however I cannot confirm this myself.

@igdev116
Copy link

igdev116 commented Jun 6, 2021

I have resolved this problem
Type npm install react-datepicker --save in terminal
Then import these in your component

import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";

Usage

const Example = () => {
  return (
    <DatePicker />
  );
};

Good luck :)

@patricktan98
Copy link

I still encounter this problem in production build, may I know how's the update?

@thilinadinith
Copy link

same problem

@Enache-Ionut
Copy link

same problem here

@minhld-ows
Copy link

minhld-ows commented Sep 26, 2022

You need to install both "@types/react-datepicker" & "react-datepicker"

@jl0zano
Copy link

jl0zano commented Sep 30, 2022

You need to install both "@types/react-datepicker" & "react-datepicker"

Thanks! This was my issue. I had only installed "@types/react-datepicker". Worked great after installing "react-datepicker" too.

@jhonvy95
Copy link

You need to install both "@types/react-datepicker" & "react-datepicker"

thankss so much, this worked for me

@AbhiSmith
Copy link

just run npm install --save @types/react-datepicker

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

No branches or pull requests