preactjs / preact-compat

ATTENTION: The React compatibility layer for Preact has moved to the main preact repo.
http://npm.im/preact-compat
MIT License
950 stars 148 forks source link

Module not found: Error: Can't resolve 'react-diff-viewer' #511

Closed liudonghua123 closed 5 years ago

liudonghua123 commented 5 years ago

I tried to create a material demo using preact-cli, and I want to use react-diff-viewer, so I installed it via npm i react-diff-viewer react-list-drag-and-drop -S.

D:\code\material-demo>npm i react-diff-viewer react-list-drag-and-drop -S
npm WARN react-diff-viewer@1.0.3 requires a peer of react@^15.3.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.npm WARN react-diff-viewer@1.0.3 requires a peer of react-dom@^15.3.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-list-drag-and-drop@0.8.1 requires a peer of react@^16.3.2 but none is installed. You must install peer dependencies yourself.
npm WARN react-list-drag-and-drop@0.8.1 requires a peer of react-dom@^16.3.2 but none is installed. You must install peer dependencies yourself.
+ react-diff-viewer@1.0.3
+ react-list-drag-and-drop@0.8.1

When I run npm run dev, I got the error belows.

Build failed!

✖ ERROR ./node_modules/babel-loader/lib??ref--0!./src/routes/home/index.js
Module not found: Error: Can't resolve 'react-diff-viewer' in 'D:\code\material-demo\src\routes\home'
 @ ./node_modules/babel-loader/lib??ref--0!./src/routes/home/index.js 14:0-48
 @ ./src/routes/home/index.js
 @ ./src/components/app.js
 @ ./src/index.js
 @ ./node_modules/preact-cli/lib/lib/entry.js
 @ multi ./node_modules/preact-cli/lib/lib/entry webpack-dev-server/client webpack/hot/dev-server
liudonghua123 commented 5 years ago

I found the problem, it was the package itself issue, see https://github.com/praneshr/react-diff-viewer/issues/6.