volta icon indicating copy to clipboard operation
volta copied to clipboard

Global tools that depend on each other are not able to see each other

Open Christoph-AK opened this issue 2 years ago • 1 comments

When globally installing @shopify/cli and @shopify/theme with volta (or npm while running volta) and running shopify theme, no subcommands are found.

Seems like it might be by design, as I understand volta kinda sandboxes all the tools. Is there a way to enter exceptions to the sandboxing? Can't use volta otherwise.

Christoph-AK avatar Nov 17 '23 17:11 Christoph-AK

This message appears when you try to execute this command:

shopify theme init
?  Command `theme init` not found. Did you mean `kitchen-sink async`?

I have the same problem.

I managed to escape this by installing local dependencies in the root folder and call shopify theme init like this:

  1. mkdir shopify
  2. cd shopify
  3. yarn add @shopify/cli @shopify/theme
  4. ./node_modules/@shopify/cli/bin/run.js theme init also
  5. ./node_modules/@shopify/cli/bin/run.js theme dev --store abc_theme.myshopify.com

So the folder structure will be like this:

-- abc_theme
-- node_modules
-- package.json
-- yarn.lock

Another thing, I have compared the global packages in this path: /home/nadhir/.volta/tools/shared/@shopify/cli /home/nadhir/.volta/tools/shared/@shopify/theme

And the local packages: /home/nadhir/shopify/node_modules/@shopify/cli /home/nadhir/shopify/node_modules/@shopify/theme

I found that they are the same, as meld software said.

I want to find if the @shopify/cli package calling @shopify/theme in somewhere... then change it to call theme with the right path.

Solutions to this problem:

  1. Deactivate volta, and let yarn or npm to manage global packages.
  2. Improve @shopify/cli to search for @shopify/theme if volta is installed.

Test 1:

  • Try to uninstall volta then install yarn as system app, then install @shopify as global, then re-install volta.

I faced this problem yesterday. I'm new to Shopify Dev, And I do not have much time to find solution to this problem right now. because the local solution works for me.

My Regards.

NadhirBoukhenifra avatar Nov 17 '23 23:11 NadhirBoukhenifra