【问题标题】:yarn dev error Command failed with exit code 1 when running guest-book example运行留言簿示例时,纱线开发错误命令失败,退出代码为 1
【发布时间】:2021-10-08 05:38:22
【问题描述】:

我正在尝试使用yarn dev 来运行guest-book example 之后的留言簿示例,但这就是我得到的:

Computer@Summerbook MINGW64 ~/Documents/VS Code Projects/near apps/guest-book (master)
$ yarn dev
yarn run v1.22.11
$ yarn build:contract:debug && near dev-deploy && nodemon --watch assembly -e ts --exec yarn dev:start
$ asb --target debug
'asb' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

我认为错误是这样的:

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

package.json 中的脚本是:

 "scripts": {
    "build": "yarn build:contract && yarn build:web",
    "build:contract": "asb",
    "build:contract:debug": "asb --target debug",
    "build:web": "parcel build src/index.html --public-url ./",
    "deploy": "yarn build && near deploy && gh-pages -d dist/",
    "dev": "yarn build:contract:debug && near dev-deploy && nodemon --watch assembly -e ts --exec yarn dev:start",
    "lint": "eslint \"./**/*.js\" \"./**/*.jsx\"",
    "start": "yarn deploy && parcel src/index.html",
    "dev:start": "env-cmd -f ./neardev/dev-account.env parcel src/index.html",
    "test": "yarn build:contract:debug && asp && jest"

我已尝试再次安装依赖项,但没有成功。 我相信我在与 package.json 相同的目录下运行。 我可以在这里做什么?是什么导致“asb”出现错误?感谢您的帮助!

【问题讨论】:

  • yarn 然后yarn dev 应该可以正常工作,尽管我从未在 mingw 下尝试过。尝试使用常规 Windows 终端(cmd 或 powershell)。如果这没有帮助,请尝试从头开始设置项目并提供整个过程的完整日志
  • 我尝试了yarn 然后yarn dev 并且成功了!我在 VS Code 中使用常规 Windows 终端而不是终端有什么不同吗?谢谢!

标签: visual-studio nearprotocol


【解决方案1】:

从评论中移出我的答案:

yarn 然后yarn dev 应该可以工作。尝试使用常规 Windows 终端(cmd 或 powershell)。

您的 VS 代码似乎使用了 mingw(Windows 的 bash)环境,它带来了自己的一套怪癖。您可能希望将 VS 代码中的默认终端切换回 cmd 或 powershell。

【讨论】:

  • 当然我会换那个。
【解决方案2】:

请尝试sudo npm install -g asbuild

欢迎在https://github.com/near-examples/guest-book/issues/543+1 上留言

【讨论】:

  • 不,这在终端中不起作用。我收到了这个错误:'sudo' is not recognized as an internal or external command, operable program or batch file.
  • npm install -g asbuild 工作!谢谢。
【解决方案3】:

似乎对 sdk 的更新从未与示例合并。我在这里更新了它:https://github.com/near-examples/guest-book/pull/539#pullrequestreview-721177317

请再试一次,如果问题已解决,请告诉我。谢谢!

【讨论】:

  • 它已修复。谢谢!
猜你喜欢
  • 1970-01-01
  • 2022-01-01
  • 1970-01-01
  • 2018-07-12
  • 2015-10-12
  • 1970-01-01
  • 1970-01-01
  • 2021-04-02
  • 2021-09-15
相关资源
最近更新 更多