Mark
Mark

Reputation: 5058

Using plain-draggable library with React

I want to use the plain-draggable library with my React app. To package.json I added: "plain-draggable": "^2.5.14",

Then I ran npm i. Upon starting the app using react-scripts start I see the error in the console:

`Module not found: Can't resolve 'anim-event' in '/Users/use/app/tom/new_version/app/node_modules/plain-draggable'`

I then go into the module with cd node_modules/plain-draggable and run npm i. Now it works, but I need to do this every time I run the app. How can I fix this?

Upvotes: 1

Views: 347

Answers (2)

CuriousMind
CuriousMind

Reputation: 3173

You are facing this problem because there are quite a few dependencies in the plain-draggable, which should have been part of dependencies but are declared inside devDependencies. Check below snapshot from Github

enter image description here

As stated by @ozan-yurtsever, you need to install those dependencies along with plain-draggable and add it to your own dependencies section.

Upvotes: 1

Ozan Yurtsever
Ozan Yurtsever

Reputation: 1304

You can install the missing dependencies in your main project rather than going to the node_modules folder and reinstalling it each time.

Try it in the root directory of your application;

npm install --save anim-event cssprefix m-class-list pointer-event

Upvotes: 2

Related Questions