1

When I try to run npm run dev or npm run build I get the following error:

npm run dev

> dev
> next

/usr/bin/bash: D:Tempdev-1656515078305.sh: command not found

This is my current 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"
  }
}

I have absolutely no idea why this error occurs.

NodeJS and NPM are installed:

node -v
v16.14.2

npm -v
8.13.1
PlutoHDDev
  • 540
  • 7
  • 25
  • Try `npx next` and see what happens. Also `ls node_modules/.bin` – mikemaccana Jun 29 '22 at 15:10
  • Interesting that the error message indicates "D:" (typically a Windows drive identifier) and `/usr/bin/bash` (non-Windows, unless it's WSL). – jarmod Jun 29 '22 at 15:11
  • `npx next` runs without any errors. Here is the result of `ls node_modules/.bin`: https://www.toptal.com/developers/hastebin/zuporoniti.yaml – PlutoHDDev Jun 29 '22 at 15:12
  • I have tried `cmd` as well as PowerShell, the error occurs in both. – PlutoHDDev Jun 29 '22 at 15:13
  • Do you need to do `npm install`? Do you have `next` installed globally by chance? `npm uninstall next -g` to remove it and then try `npm run dev` again. – Wyck Jun 29 '22 at 15:16
  • I ran `npm install`, this does not change anything. `next` is not installed globally. – PlutoHDDev Jun 29 '22 at 15:28
  • I have removed and reinstalled NodeJS and updated git to the latest version (just in case this is related to Git Bash), but this does not change anything. – PlutoHDDev Jun 29 '22 at 16:18

1 Answers1

0

I've encountered this issue when calling one run-script from another. Using npm-run-all and run-s to launch commands fixed my issues in some scenarios. I suspect that npm is making some assumptions about the shell and path separator based on the 'platform' or not properly introspecting the running shell.