我正在学习ReactJS,并尝试按照video
设置环境但是在cmd中执行“ npm run it”命令时出现错误。
这是package.json文件:
{
"name": "react-folder",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"it": "webpack-dev-server --hot"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-preset-react": "^6.24.1",
"webpack": "^4.29.3",
"webpack-dev-server": "^3.1.14"
},
"dependencies": {
"react": "^16.8.1",
"react-dom": "^16.8.1"
}
}
答案 0 :(得分:1)
npm install webpack-cli
(如果您使用的是npm的旧版本,请使用npm install webpack-cli --save
,也可以使用npx create-react-app AppName
轻松创建react应用
答案 1 :(得分:0)
第一次尝试安装webpack-cli,因为现在必须运行webpack。
npm i -D webpack-cli