无法在一台计算机上的git bash中运行“npm start”,但另一方面我可以

时间:2016-02-09 00:30:05

标签: node.js git bash npm electron

我正在使用Electron来设计我的笔记本电脑和台式机上的应用程序。为了管理两台不同机器之间的代码库,我正在使用Git。在我的笔记本电脑上,我可以在Git Bash中运行npm start,但在我的桌面上,我不能。我能想到的唯一一条信息(虽然我不知道它是否有用)是我的package.json,它存在于两台机器上:

{
  "name": "nbastatsapp",
  "version": "0.0.1",
  "description": "NBA stats app",
  "main": "index.js",
  "scripts": {
    "start": "electron ."
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/nbastatsapp/NBAStatsApp.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/nbastatsapp/NBAStatsApp/issues"
  },
  "homepage": "https://github.com/nbastatsapp/NBAStatsApp#readme",
  "devDependencies": {
    "electron-prebuilt": "^0.36.7"
  }
}

当我在桌面的Git Bash上运行npm start时,我得到以下内容:

$ npm start

> nbastatsapp@0.0.1 start E:\NBAStatsApp
> electron .

'node' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 10.0.10240
npm ERR! argv "E:\\nodejs\\node.exe" "E:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v4.2.6
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! nbastatsapp@0.0.1 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nbastatsapp@0.0.1 start script 'electron .'.
npm ERR! This is most likely a problem with the nbastatsapp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     electron .
npm ERR! You can get their info via:
npm ERR!     npm owner ls nbastatsapp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     E:\NBAStatsApp\npm-debug.log

为避免泛滥帖子,以下是此错误的完整输出日志链接:http://textuploader.com/525d1

如何在桌面上的Git Bash中启用npm start

1 个答案:

答案 0 :(得分:1)

在您的计算机上安装node.js并确保它位于%PATH%