Bin/ember-cli 报告 Node 18.18.1 相关问题

我正在尝试在我的 Linux 笔记本电脑上运行开发安装。

我有一个脚本,它从 discourse_docker 获取 Ruby、imagemagick 和 nodejs 的版本,并使用 asdf 设置它们。这是其中的一部分:

  RUBY_VERSION=$(grep  “^ARG RUBY_VERSION” $DISCOURSE_DOCKER_SRC/image/base/slim.Dockerfile |cut -d'=' -f2)
  echo “GOT RUBY VERSION!! $RUBY_VERSION”
  asdf install ruby $RUBY_VERSION
  asdf global ruby $RUBY_VERSION
  IMAGE_MAGICK_VERSION=$(grep -e ^IMAGE_MAGICK_VERSION ~/src/discourse-repos/discourse_docker/image/base/install-imagemagick|cut -d'\"' -f2)
  echo “GOT IMAGE_MAGICK_VERSION: $IMAGE_MAGICK_VERSION”
  asdf install imagemagick $IMAGE_MAGICK_VERSION
  asdf global imagemagick $IMAGE_MAGICK_VERSION
  # 2023-04-24 debian and pop!os have different nodejs versions
  NODE_VERSION=$(docker run discourse/base:release bash -c 'node --version'|cut -d'v' -f2)
  #NODE_VERSION=$(grep node ~/src/discourse-repos/discourse/.tool-versions|awk '{print $2}')
  echo “GOT NODEJS version: $NODE_VERSION”
  asdf install nodejs $NODE_VERSION
  asdf global nodejs $NODE_VERSION

但是当我运行 bin/ember-cli 时,我得到这个:

./bin/ember-cli
warning Resolution field “unset-value@2.0.1” is incompatible with requested version “unset-value@^1.0.0”
error ember-template-lint@6.0.0: The engine “node” is incompatible with this module. Expected version “^18.18.0 || ^20.9.0 || >=21.1.0”. Got “18.17.1”
error Found incompatible module.

18.17.1 是 Discourse 中的版本。为什么我需要一个与 Discourse 运行版本不同的开发版本?

当我更新到 18.18.0 然后运行 ember-cli 时,我得到一个“SyntaxError: Unexpected token in JSON at position 219260”。. . 我无法完全理解的东西。

现在该尝试什么?

有没有可靠的方法来查看我的开发环境是否适合进行开发?似乎我每个月都要花一个小时或更长时间来尝试让我的开发系统正常工作。人们(比如 @sam@falco)真的在使用 docker 开发环境吗?也许我应该以那个容器为目标来获取 Ruby 和 Node 的版本?

我总是通过 ASDF 选择最新的 LTS 版本来运行 NodeJS。

我不会在 Docker 上运行我的开发环境。

我可以理解这对完全的新手来说可能更容易,但对我个人而言,这会太麻烦了。

1 个赞

太棒了。有道理。我想它更新的频率足够低,所以你可以手动完成。

我明天试试。

我们在这方面是一样的。 :wink:

1 个赞

太好了!使用 Node 20.9.0 终于让我的开发构建再次正常工作了。我有点困惑为什么那个版本能工作,而 Discourse 容器中的版本却不行,并且想知道当容器中的 18.whatever 版本在我的开发环境中失败时,它在容器中会如何工作,但我想我到时候会看到的。

谢谢你的帮助。