我运行命令“npm run dev”时出现错误

问题描述 投票:0回答:1

npm 错误!缺少脚本:“dev”npm 错误! npm 错误!查看列表 脚本,运行:npm 错误! npm 运行

npm 错误!此运行的完整日志可以在以下位置找到: C:\Users\junai\AppData\Local pm-cache_logs�4-01-06T10_14_38_136Z-debug-0.log

package.json

{
  "name": "golureacting",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview"
  },
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@types/react": "^18.2.43",
    "@types/react-dom": "^18.2.17",
    "@vitejs/plugin-react": "^4.2.1",
    "eslint": "^8.55.0",
    "eslint-plugin-react": "^7.33.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.4.5",
    "vite": "^5.0.8"
  }
}

为什么我收到此错误,有什么解决方案请告诉我

reactjs react-native npm npm-scripts npm-start
1个回答
-1
投票

开始之前,请检查一次以下事项。我们通常会犯这些错误。那些是-

  1. 移至存在 package.json 的项目根目录。
  2. 执行
    npm install
    yarn install
    安装所有依赖项。

完成上述步骤后,然后点击

npm run dev
开始您的项目。

© www.soinside.com 2019 - 2024. All rights reserved.