Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Shopify Cli install doesn't work #1610

Closed
2 tasks done
jshamg opened this issue Mar 15, 2023 · 10 comments
Closed
2 tasks done

[Bug]: Shopify Cli install doesn't work #1610

jshamg opened this issue Mar 15, 2023 · 10 comments
Labels
Type: Bug Something isn't working

Comments

@jshamg
Copy link

jshamg commented Mar 15, 2023

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Other

Expected behavior

Working Shopify Cli

Actual behavior

Some random node errors

Verbose output

usr@Users-MBP ~ % shopify version --verbose
/usr/local/opt/node/bin/node[22259]: ../src/module_wrap.cc:599:MaybeLocal<v8::Promise> node::loader::ImportModuleDynamically(Local<v8::Context>, Local<v8::Data>, Local<v8::Value>, Local<v8::String>, Local<v8::FixedArray>): Assertion `(it) != (env->id_to_function_map.end())' failed.
 1: 0x10396e87c node::Abort() [/usr/local/Cellar/node/19.8.0/bin/node]
 2: 0x10396e867 node::Abort() [/usr/local/Cellar/node/19.8.0/bin/node]
 3: 0x103930745 node::loader::ImportModuleDynamically(v8::Local<v8::Context>, v8::Local<v8::Data>, v8::Local<v8::Value>, v8::Local<v8::String>, v8::Local<v8::FixedArray>) [/usr/local/Cellar/node/19.8.0/bin/node]
 4: 0x103bf906f v8::internal::Isolate::RunHostImportModuleDynamicallyCallback(v8::internal::MaybeHandle<v8::internal::Script>, v8::internal::Handle<v8::internal::Object>, v8::internal::MaybeHandle<v8::internal::Object>) [/usr/local/Cellar/node/19.8.0/bin/node]
 5: 0x103f6cac3 v8::internal::Runtime_DynamicImportCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/Cellar/node/19.8.0/bin/node]
 6: 0x1037af2b4 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvInRegister_NoBuiltinExit [/usr/local/Cellar/node/19.8.0/bin/node]
 7: 0x10385c411 Builtins_CallRuntimeHandler [/usr/local/Cellar/node/19.8.0/bin/node]
 8: 0x103726f5c Builtins_InterpreterEntryTrampoline [/usr/local/Cellar/node/19.8.0/bin/node]
zsh: abort      shopify version --verbose

Reproduction steps

  1. brew update && brew upgrade
  2. brew tap shopify/shopify
  3. brew install shopify-cli
  4. shopify version

Operating System

Mac OS Ventura 13.0.1 (Intel)

Shopify CLI version (check your project's package.json if you're not sure)

3.44.1

Shell

zsh

Node version (run node -v if you're not sure)

tried a lot, but i think doesnt matter because in the warning it says node v19.8.0 which comes with the brew package

What language and version are you using in your application?

No response

@jshamg jshamg added the Type: Bug Something isn't working label Mar 15, 2023
@thevrus
Copy link

thevrus commented Mar 15, 2023

Same here

@jshamg
Copy link
Author

jshamg commented Mar 15, 2023

CONFIRMED. issue regarding node v19.8.0. just used the npm package way. same error with nvm version 19.8.0. If i switch back to lts which is v18.15.0 everything is working. Just switch for the brew package to node lts version. Should be smarter anyways...

@choogoor
Copy link

Same here. I've just updated the node to 19.8.0 and CLI stops working.

@thevrus
Copy link

thevrus commented Mar 15, 2023

Does anyone have a solution for this issue?

@yosefman
Copy link

I have installed node 18 with brew install node@18 and then i manually deleted the homebrew/Cellar/node folder and renamed the node@18 to node and renamed the inner folder from 18.15.0 to 19.8.0 and it worked for me.

@fbe28
Copy link

fbe28 commented Mar 16, 2023

Same here, just upgraded to 3.0 today and I'm facing the issue described on this thread.

@houseofpsalm
Copy link

I have installed node 18 with brew install node@18 and then i manually deleted the homebrew/Cellar/node folder and renamed the node@18 to node and renamed the inner folder from 18.15.0 to 19.8.0 and it worked for me.

I followed this and it worked for me. So dfefinitely an issue with node 19.9.0

@jpapini
Copy link

jpapini commented Mar 16, 2023

A temporary workaround:

$ brew uninstall shopify-cli
$ brew autoremove
$ brew cleanup
$ brew edit shopify-cli

Then replace node occurences with node@18:

# frozen_string_literal: true

require "formula"
require "language/node"
require "fileutils"

class ShopifyCli < Formula
  desc "A CLI tool to build for the Shopify platform"
  homepage "https://github.com/shopify/cli#readme"
  url "https://registry.npmjs.org/@shopify/cli/-/cli-3.44.1.tgz"
  sha256 "00cb4f8cf75d843e22d425b3f5b0c0099a31f1f0e51351d7283793b9985c5a27"
  license "MIT"
-  depends_on "node"
+  depends_on "node@18"
  depends_on "ruby"
  depends_on "git"

  resource "cli-theme-commands" do
    url "https://registry.npmjs.org/@shopify/theme/-/theme-3.44.1.tgz"
    sha256 "a4875c3f82630d5e1ab49bc772195355c00f9b2a621817a3ada651debd834db8"
  end

  livecheck do
    url :stable
  end

  def install
    existing_cli_path = `which shopify`
    unless existing_cli_path.empty? || existing_cli_path.include?("homebrew")
      opoo <<~WARNING
      We've detected an installation of the Shopify CLI at #{existing_cli_path} that's not managed by Homebrew.
      Please ensure that the Homebrew line in your shell configuration is at the bottom so that Homebrew-managed
      tools take precedence.
      WARNING
    end

    system "npm", "install", *Language::Node.std_npm_install_args(libexec)

    original_executable_path = "#{libexec}/bin/shopify"
    executable_path = "#{original_executable_path}"
    FileUtils.move(original_executable_path, "#{executable_path}-original")
    executable_content = <<~SCRIPT
-      #!/usr/bin/env #{Formula["node"].opt_bin}/node
+      #!/usr/bin/env #{Formula["node@18"].opt_bin}/node
      process.env.SHOPIFY_RUBY_BINDIR = "#{Formula["ruby"].opt_bin}"
      process.env.SHOPIFY_HOMEBREW_FORMULA = "shopify-cli"
      import("./shopify-original");
    SCRIPT
    File.write executable_path, executable_content
    FileUtils.chmod("+x", executable_path)

    bin.install_symlink executable_path

    resource("cli-theme-commands").stage {
      system "npm", "install", *Language::Node.std_npm_install_args(libexec)
    }
  end

  def post_install
    message = <<~POSTINSTALL_MESSAGE
      Congratulations, you've successfully installed Shopify CLI 3!
      Global installations of Shopify CLI 3 should only be used to work on Shopify
      themes. To learn about the changes to theme workflows in this version, refer
      to https://shopify.dev/themes/tools/cli/migrate#workflow-changes
      If you want to keep using Shopify CLI 2, then you can install it again using
      `brew install shopify-cli@2` and run commands using the `shopify2` program
      name (for example, `shopify2 theme push` and `shopify2 extension push`).
      Note however that Shopify CLI 2 will be sunset on May 31, 2023.
    POSTINSTALL_MESSAGE
    message.each_line { |line| ohai line.chomp }
  end
end

Save the file and then:

$ brew install shopify-cli

It will install Node.js 18 instead of 19.

I think its better than editing manually internal paths of Homebrew because it can broke other tools using node as dependency.

@choogoor
Copy link

It looks like it was on the node side. I run the brew upgrade again today, it upgrades the node to 19.8.1. and now everything works well.

@matteodepalo
Copy link
Contributor

As reported by @choogoor this was fixed with the latest node version. Reference to that here nodejs/node#47096.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants