Error: "'node' not recognized as..." when I try to run the file with package.json script

Error: "'node' not recognized as..." when I try to run the file with package.json script

我正在学习 Node,当我尝试使用 npm startnpm run start 运行 我的项目时,出现错误“node is not recognized as an internal or external command” .如果我使用 node index.js,它会起作用。我查看了 Node 环境变量,我的 Node 版本是 v16.13.2,npm 是 8.4.1。 我的 package.json:

{
  "name": "node-express-practica",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  },
  "license": "ISC",
  "devDependencies": {
    "@babel/cli": "^7.17.0",
    "@babel/core": "^7.17.2",
    "@babel/preset-env": "^7.16.11",
    "@babel/register": "^7.17.0",
    "nodemon": "^2.0.15"
  }
}

运行 作为管理员的命令应该适合你。