【发布时间】:2023-02-14 23:22:51
【问题描述】:
当我尝试运行 npm run dev 或 npm run build 时,出现以下错误:
npm run dev
> dev
> next
/usr/bin/bash: D:Tempdev-1656515078305.sh: command not found
这是我现在的package.json:
{
"private": true,
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"type-check": "tsc"
},
"dependencies": {
"bootstrap": "^5.1.3",
"marked": "^4.0.17",
"next": "latest",
"nodemailer": "^6.7.5",
"react": "^18.1.0",
"react-bootstrap": "^2.4.0",
"react-dom": "^18.1.0",
"react-icons": "^4.4.0"
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^4.1.3",
"@types/node": "^17.0.35",
"@types/react": "^18.0.9",
"@types/react-dom": "^18.0.4",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
"eslint": "^8.18.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.2.3",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"postcss-preset-env": "^7.6.0",
"sass": "^1.53.0",
"tailwindcss": "^3.0.24",
"typescript": "4.6"
}
}
我完全不知道为什么会出现此错误。
安装 NodeJS 和 NPM:
node -v
v16.14.2
npm -v
8.13.1
【问题讨论】:
-
试试
npx next看看会发生什么。还有ls node_modules/.bin -
有趣的是,错误消息指示“D:”(通常是 Windows 驱动器标识符)和
/usr/bin/bash(非 Windows,除非它是 WSL)。 -
npx next运行没有任何错误。这是ls node_modules/.bin的结果:toptal.com/developers/hastebin/zuporoniti.yaml -
cmd和PowerShell我都试过了,两者都报错。 -
你需要做
npm install吗?您是否偶然在全球范围内安装了next?npm uninstall next -g删除它,然后再次尝试npm run dev。
标签: node.js npm next.js npm-run