我正在尝试使用Next.js,但是我收到以下错误:
Module build failed: Error: Cannot find module 'react-hot-loader/babel' from '/home/ugurkaya/Desktop'
以下是我的package.json:
"name": "hello-next",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^6.0.4-canary.6",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-hot-loader": "next"
}
当我收到此错误时,我手动添加了react-hot-loader
依赖项,但它没有解决。期待你的帮助!
答案 0 :(得分:1)
我只是通过
解决了此问题npm install react-hot-loader --save-dev
答案 1 :(得分:0)
这个问题是因为 react 在 dev 依赖中找不到 react-hot-loader 造成的
你可以解决这个问题,你只需要安装 react-hot-loader 作为开发依赖
npm install react-hot-loader --save-dev