简体   繁体   English

Next.js:模块构建失败:错误:无法从“/home/ugurkaya/Desktop”中找到模块“react-hot-loader/babel”

[英]Next.js: Module build failed: Error: Cannot find module 'react-hot-loader/babel' from '/home/ugurkaya/Desktop'

I am trying to get started with Next.js, yet I receive the following error:我正在尝试开始使用 Next.js,但收到以下错误:

Module build failed: Error: Cannot find module 'react-hot-loader/babel' from '/home/ugurkaya/Desktop'

The following is my package.json:以下是我的 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"
  }

I added the react-hot-loader dependency manually when I get this error, yet it did not solve.当我收到此错误时,我手动添加了react-hot-loader依赖项,但它没有解决。 Looking forward your helps!期待您的帮助!

我解决了这个问题

npm install react-hot-loader --save-dev

This issue is generate because react not find react-hot-loader in dev dependancy生成此问题是因为 react 在 dev 依赖项中找不到 react-hot-loader

You can solve this problem you just need to install react-hot-loader as dev dependancy你可以解决这个问题,你只需要安装 react-hot-loader 作为开发依赖

npm install react-hot-loader --save-dev

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 模块构建失败(来自 ./node_modules/babel-loader/lib/index.js):错误:找不到模块“babel-preset-react” - Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-preset-react' 模块构建失败(来自 ./node_modules/babel-loader/lib/index.js):错误:找不到模块“./src/data” - Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module './src/data' 错误 in./src/app.js 模块构建失败(来自./node_modules/babel-loader/lib/index.js):错误:找不到模块'@babel/preset-present-env' - ERROR in ./src/app.js Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module '@babel/preset-present-env' 模块构建失败(来自./node_modules/babel-loader/lib/index.js):错误:找不到模块'babel-core' - Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-core' 找不到.babel和react-hot-loader的正确配置 - Can't find the proper configuration for .babel and react-hot-loader 反应构建错误:模块构建失败(来自 ./node_modules/babel-loader/lib/index.js): - React build error: Module build failed (from ./node_modules/babel-loader/lib/index.js): React 应用程序的编译错误:模块构建失败(来自./node_modules/babel-loader/lib/index.js) - Compile error for a React app: Module build failed (from ./node_modules/babel-loader/lib/index.js) 在Babel 6中使用react-hot-loader - Using react-hot-loader with Babel 6 模块构建失败:错误:找不到模块'@ babel / core' - Module build failed: Error: Cannot find module '@babel/core' 错误:模块构建失败(来自 ./node_modules/babel-loader/lib/index.js):语法错误: - Error: Module build failed (from ./node_modules/babel-loader/lib/index.js): SyntaxError:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM