sh:next:即使重新安装节点模块后,在 nextJS 项目上也找不到命令

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

我刚刚从我的

windows
机器上克隆了我正在处理的一个存储库,我现在将它放在我的
MacOS
上,我点击了
npm i
,它创建了
node_modules
,但是当我这样做时
npm run dev
它给出了我这个错误:

rakibulb@Rakibuls-MacBook-Air advanced-todolist % npm run dev

> [email protected] dev
> next dev

sh: next: command not found

我在网上和堆栈溢出上查找了解决方案,大多数人说他们只是删除了

node_modules
并重新安装,我尝试过但它不起作用。我也尝试过更新我的
npm
版本和
Node
版本,但似乎没有任何帮助。

这是我的

packagage.json

{
  "name": "todo-enhanced",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@hookform/resolvers": "^3.3.4",
    "@next-auth/prisma-adapter": "^1.0.7",
    "@prisma/client": "^5.13.0",
    "@radix-ui/react-dialog": "^1.0.5",
    "@radix-ui/react-label": "^2.0.2",
    "@radix-ui/react-select": "^2.0.0",
    "@radix-ui/react-slot": "^1.0.2",
    "@vercel/postgres": "^0.8.0",
    "bcrypt": "^5.1.1",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "lucide-react": "^0.378.0",
    "next": "14.2.3",
    "next-auth": "^4.24.7",
    "react": "^18",
    "react-dom": "^18",
    "react-hook-form": "^7.51.4",
    "react-hot-toast": "^2.4.1",
    "tailwind-merge": "^2.3.0",
    "tailwindcss-animate": "^1.0.7",
    "zod": "^3.23.8"
  },
  "devDependencies": {
    "@types/bcrypt": "^5.0.2",
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "eslint": "^8",
    "eslint-config-next": "14.2.3",
    "postcss": "^8",
    "prisma": "^5.13.0",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
}

我也和我一样水平

package.json
:

node.js npm next.js npm-install
1个回答
0
投票

这里的问题是我没有全局安装

next.js
,所以我所要做的就是
npm i -g nextjs
,这确保了我的整个设备中有
next.js
,然后它发现了
next.js

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