在Udemy类中,我正在创建一个Next.js项目。我有以下package.json
{
"name": "nextjsdemo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"author": "",
"license": "ISC",
"dependencies": {
"next": "^9.0.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
}
}
我的目录结构如下。
npm install --save next react react-dom
当我运行命令
npm run dev
我收到错误:
npm ERR! missing script: dev
我在npm run build上也收到类似的错误。
我做错了什么?
谢谢
编辑1 我可以使它起作用的唯一方法是在V4.2.3之前降级。最新版本不起作用似乎很奇怪。