'node' 不是内部或外部命令,也不是可运行的程序或批处理文件;仅在尝试启动应用程序时

'node' is not recognized as an internal or external command, operable program or batch file; Only when trying to start app

因此,如果我想 npm 安装一个包或检查节点或 npm 版本,它可以工作,但如果我尝试使用任何脚本启动应用程序,它就会显示这个。 [已编辑]

$ npm start

> nibblin@0.0.0 start C:\Users\trevc\Desktop\Projects\nibblin
> concurrently "npm run server" "npm run client"

'node' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nibblin@0.0.0 start: `concurrently "npm run server" "npm run 
client"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nibblin@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional 
logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\trevc\AppData\Roaming\npm-cache\_logs18-08- 
05T14_06_10_006Z-debug.log

这是我的包裹

{
  "name": "nibblin",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "server": "node ./bin/www",
    "client": "npm start --prefix client",
    "start": "concurrently \"npm run server\" \"npm run client\""
  },
  "dependencies": {
    "cookie-parser": "~1.4.3",
    "debug": "~2.6.9",
    "express": "~4.16.0",
    "http-errors": "~1.6.2",
    "jade": "~1.11.0",
    "morgan": "~1.9.0",
    "concurrently": "^3.6.1"
  }
}

删除所有节点模块并尝试重新安装后,我遇到了这个问题

$ npm i
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading 
Browserslist >3.0 config used in other tools.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading 
Browserslist >3.0 config used in other tools.
npm WARN deprecated istanbul-lib-hook@1.2.1: 1.2.0 should have been a major 
version bump

> uglifyjs-webpack-plugin@0.4.6 postinstall 
C:\Users\trevc\Desktop\Projects\nibblin\client\node_modules\uglifyjs-webpack- 
plugin
> node lib/post_install.js

'node' is not recognized as an internal or external command,
operable program or batch file.
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is 
installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 
(node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 
fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: 
{"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! uglifyjs-webpack-plugin@0.4.6 postinstall: `node 
lib/post_install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the uglifyjs-webpack-plugin@0.4.6 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional 
logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\trevc\AppData\Roaming\npm-cache\_logs18-08- 
05T14_50_21_506Z-debug.log

这只发生在我用 create-react-app 创建的客户端文件夹中

您 运行 的 npm 脚本是 node server.js 但在您的 package.json 中您将启动脚本定义为 node ./bin/www.

react_redux_express_starter 锅炉播放器中没有 bin 或 www 文件夹。所以我想要么你从另一个样板复制了一个package.json,要么弄乱了文件结构,要么运行命令在错误的目录中。