尝试 npm install nw-builder 时出现 Git 错误 -4058

发布于 2025-01-16 05:47:16 字数 2194 浏览 2 评论 0原文

我刚刚在桌面上创建了一个新文件夹并将其加载到 VSCode,以便我可以开始构建/学习 NW.js。我做的第一件事是打开 VSCode 终端并执行 npm init -y,然后继续运行 npm install nw@sdk。没有任何错误。

现在我的新文件夹有一个 package.json、一个 package-lock.jsonnode_modules 文件夹。

package.json 内容:

{
  "name": "rename-merra-app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "nw": "^0.62.1-sdk"
  }
}

当我尝试运行 npm install nw-builder --save-dev 时,如参考建议 @ https://www.npmjs.com/package/nw-builder,我收到以下错误

npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -4058
npm ERR! enoent An unknown git error occurred
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Misharin\AppData\Local\npm-cache\_logs\2022-03-23T03_41_13_504Z-debug-0.log

<一href="https://i.sstatic.net/PTTht.png" rel="nofollow noreferrer">npm 后出现错误 4058 install nw-builder --save-dev

.log 文件可以在这里找到:https://pastebin.com/cZAmugRF

我已尝试以下操作

  • 重新启动 VSCode
  • 重新启动我的计算机
  • 运行 npm install (最新, 120 个软件包,版本 8.5.5)
  • 在 VSCode 之外运行 npm,直接在提示符下运行(同样的错误)
  • 删除 package-lock.json
  • 重新安装 NodeJS (17.8.0)
  • 安装旧版本NodeJS(17.7.1)
  • 搜索在后台运行的node.js(没有)
  • 禁用Windows安全
  • 运行npmcacheclear--force

有人知道如何解决此错误?

也许是 git 链接之一 (https://registry.npmjs.org/nw-builder) 来自 nw-builder 包已关闭/离线?在这种情况下,有什么办法可以让我开始使用 nw.js 进行构建吗?

感谢您的帮助!

I just created a new folder on my Desktop and loaded it to VSCode so I can start building/learning about NW.js. The first thing I've done was to open VSCode Terminal and execute npm init -y, then I've proceeded to run npm install nw@sdk. No error whatsoever.

Now my new folder has a package.json, a package-lock.json, and node_modules folder.

package.json content:

{
  "name": "rename-merra-app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "nw": "^0.62.1-sdk"
  }
}

When I try to run npm install nw-builder --save-dev as the reference suggests @ https://www.npmjs.com/package/nw-builder, I got the following error:

npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -4058
npm ERR! enoent An unknown git error occurred
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Misharin\AppData\Local\npm-cache\_logs\2022-03-23T03_41_13_504Z-debug-0.log

Error 4058 after npm install nw-builder --save-dev

The .log file can be found here: https://pastebin.com/cZAmugRF

I've tried the following:

  • Restart VSCode
  • Restart My Computer
  • Run npm install (Up to date, 120 packages, version 8.5.5)
  • Run npm outside VSCode, directly on the prompt (same error)
  • Delete package-lock.json
  • Reinstall NodeJS (17.8.0)
  • Install an older version of NodeJS (17.7.1)
  • Search for node.js running in the background (there is none)
  • Disable Windows Security
  • Run npm cache clear --force

Does anyone have any idea how to solve this error?

Maybe one of the git links (https://registry.npmjs.org/nw-builder) from the nw-builder package is down/offline? In that case, is there any way around it so I can start building with nw.js?

Thank you for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

新人笑 2025-01-23 05:47:16

确保您已安装 Git:

您可能想要更改code to:

  "devDependencies": {
    "nw": "0.62.1-sdk"
  }

^如果是在sdk版本之后发布的,可以下载普通版本。

我没有使用过nw-builder,但据我了解,它已经好几年没有收到任何更新了。有一个与此相关的 GitHub 问题:

最后,以下是有关如何手动创建自己的构建的说明:

更多教程位于:

Make sure you have Git installed:

You'll likely want to change your code to:

  "devDependencies": {
    "nw": "0.62.1-sdk"
  }

The ^ can download the normal version if it was published after the sdk version.

I haven't used nw-builder, but from my understanding, it hasn't received any updates in several years. There is a GitHub issue related to this:

Finally, here are instructions for how to manually create your own build:

More tutorials are at:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文