gpt4 book ai didi

javascript - 找不到模块 'babel-core' 中的错误。使用 react.js、webpack 和 express 服务器

转载 作者:IT王子 更新时间:2023-10-29 02:47:51 27 4
gpt4 key购买 nike

每当我在终端中运行 webpack 时,我都会得到:

Hash: efea76b1048c3a97b963
Version: webpack 1.12.13
Time: 33ms
+ 1 hidden modules

ERROR in Cannot find module 'babel-core'

这是我的webpack.config.js文件

module.exports = {
entry: './app-client.js',
output: {
filename: 'public/bundle.js'
},
module: {
loaders: [
{
exclude: /(node_modules|app-server.js)/,
loader: 'babel'
}
]
}
}

package.json

{
"name": "react",
"version": "1.0.0",
"description": "React polling app",
"main": "app-client.js",
"dependencies": {
"babel-loader": "^6.2.2",
"bootstrap": "^3.3.6",
"express": "^4.13.4",
"react": "^0.14.7"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}

最佳答案

你应该在安装 npm 时安装 babel-loader 和 babel-core 作为开发依赖。

npm install babel-core babel-loader --save-dev

关于javascript - 找不到模块 'babel-core' 中的错误。使用 react.js、webpack 和 express 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35215461/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com