【问题标题】:Can't run "npm start" in git bash on one computer, but on another I can无法在一台计算机上的 git bash 中运行“npm start”,但在另一台计算机上我可以
【发布时间】:2016-02-09 11:03:03
【问题描述】:

我正在使用 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?

【问题讨论】:

    标签: node.js git bash npm electron


    【解决方案1】:

    在你的电脑上安装 node.js 并确保它在%PATH%

    【讨论】:

    • 它已安装,我只是无法从 Git Bash 使用它。我可以(并且确实)在我的命令提示符下使用它。
    • 修正你的路径,这样你就可以了
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-21
    • 1970-01-01
    • 1970-01-01
    • 2020-05-19
    • 2020-06-26
    • 2011-03-30
    • 1970-01-01
    相关资源
    最近更新 更多