为什么我的 npm run dev 命令不起作用?

Why is my npm run dev command not working?

提问人:Mahan Tehrani 提问时间:7/27/2023 最后编辑:karelMahan Tehrani 更新时间:11/6/2023 访问量:221

问:

我正在使用 refine 和 react 构建一个新项目。我已经下载了所有文件和依赖项,但是当我尝试使用它们时,我收到错误。npmnpm run dev

我的文件:My files if they help

我正在尝试在此视频中执行该项目,当我键入时,出现此错误:npm run dev

[电子邮件保护] 开发 优化开发

“Crud”不被识别为内部或外部命令,可操作 程序或批处理文件。internal/modules/cjs/loader.js:905 抛出错误; ^

错误:找不到模块 “C:\Users\Administrator\Desktop@refinedev\cli\dist\cli.js” 在 Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15) 在 Function.Module._load (internal/modules/cjs/loader.js:746:27) 在 Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) 在 internal/main/run_main_module.js:17:47 { 代码: 'MODULE_NOT_FOUND', requireStack: [] }

package.json

{
  "name": "refine-project",
  "version": "0.1.0",
  "private": true,
  "type": "module",
  "dependencies": {
    "@emotion/react": "^11.8.2",
    "@emotion/styled": "^11.8.1",
    "@mui/icons-material": "^5.8.3",
    "@mui/lab": "^5.0.0-alpha.85",
    "@mui/material": "^5.8.6",
    "@mui/x-data-grid": "^6.6.0",
    "@refinedev/cli": "^2.7.4",
    "@refinedev/core": "^4.28.2",
    "@refinedev/inferencer": "^4.3.2",
    "@refinedev/kbar": "^1.1.2",
    "@refinedev/mui": "^5.0.0",
    "@refinedev/react-hook-form": "^4.1.2",
    "@refinedev/react-router-v6": "^4.1.0",
    "@refinedev/simple-rest": "^4.0.0",
    "apexcharts": "^3.41.0",
    "axios": "^0.26.1",
    "core-util-is": "^1.0.3",
    "i18next": "^20.1.0",
    "i18next-browser-languagedetector": "^6.1.1",
    "i18next-xhr-backend": "^3.2.2",
    "react": "^18.0.0",
    "react-apexcharts": "^1.4.1",
    "react-dom": "^18.0.0",
    "react-hook-form": "^7.30.0",
    "react-i18next": "^11.8.11",
    "react-router-dom": "^6.8.1",
    "webpack-dev-server": "^4.15.1"
  },
  "devDependencies": {
    "@types/node": "^18.16.2",
    "@types/react": "^18.0.0",
    "@types/react-dom": "^18.0.0",
    "@typescript-eslint/eslint-plugin": "^5.57.1",
    "@typescript-eslint/parser": "^5.57.1",
    "@vitejs/plugin-react": "^4.0.0",
    "eslint": "^8.38.0",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.3.4",
    "typescript": "^4.7.4",
    "vite": "^4.3.1"
  },
  "scripts": {
    "dev": "refine dev",
    "build": "tsc && refine build",
    "preview": "refine start",
    "refine": "refine",
    "start": "node server.js"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "refine": {
    "projectId": "SUjkIB-RDWgKs-moVUlK"
  }
}

我从“refine.new”开始了我的项目 - 我不知道这是否有帮助?

这是我尝试过的:

npm install -g npm@latest
npm i core-util-is
npm i -f    
npm cache clean --force
npm config set ignore-scripts false
reactjs npm crud mern refinejs

评论

0赞 Mahan Tehrani 7/27/2023
顺便说一句,图片是我的文件

答:

1赞 Audun Hilden 7/27/2023 #1

错误“'Crud' 未被识别为内部或外部命令”,表示您的代码正在尝试将“Crud”作为命令运行,但找不到它。

我建议将你的代码与本教程的客户端服务器存储库进行比较,以找出任何差异。并尝试使用 CTRL + SHIFT + F 在代码中搜索“Crud”,看看它是否显示出来。