App reviews, troubleshooting, and recommendations
Hi
My name is jeremy . I'm rather new to using Shopify cli, and I've been trying to create a subscription app extension .
but after running "Shopify extension create" and choosing my app and extension name , the "initializing project" process stops with this error.(it doesnt give an error when creating other extensions)
I've been looking everywhere for any sort of answer but I truly cant find what's causing this issue.
any idea's would be greatly appreciated
thank you
Solved! Go to the solution
This is an accepted solution.
Try changing shopify-cli\lib\project_types\extension\commands\serve.rb from:
def find_available_port(runtime_configuration)
return runtime_configuration unless specification_handler.choose_port?(@ctx)
chosen_port = Tasks::ChooseNextAvailablePort
.call(from: runtime_configuration.port)
.unwrap { |_error| @ctx.abort(@ctx.message("serve.no_available_ports_found")) }
runtime_configuration.tap { |c| c.port = chosen_port }
end
to:
def find_available_port(runtime_configuration)
puts "Hack fix is in place."
return runtime_configuration
end
I need to clarify i was using these instructions that shopify has provided here. and im stuck on the first step
Found it! the problem was my node so i updated it and it works , but now when i run "shopify extension serve" i get the message:
X No available ports found to run extension.
I'm running into the same problem with 'no available ports'. I'll post back here if I find a solution.
oh thank you! ive been stuck on this for days
I've found the problem - I think. At least it's working for me.
The Shopify CLI file 'choose_next_available_port.rb' method 'available' returns true or false depending on if the default port is open. To do this they try to open a socket for the port, and catch ECONNREFUSED errors. If the connection is refused the port is open, right? Well instead of throwing ECONNREFUSED I'm getting ETIMEDOUT, so it doesn't catch that, and Shopify CLI thinks the port is being used.
I've changed the rescue block to handle ETIMEDOUT instead of ECONNREFUSED and now it's working. This is on line 31 of the file 'choose_next_available_port.rb' in Shopify-CLI version 2.1.0
I got it working and it loads the Post Purchase extension successfully.
See my PR on the Shopify-CLI GitHub for the exact code change: https://github.com/Shopify/shopify-cli/pull/1372
thank you so much for the answer. i did the change and now though it takes longer but i still get the error.
Hmm strange. I wonder if it's throwing yet another error type and not the ECONNREFUSED or ETIMEDOUT.
You can edit the Shopify-CLI code to skip the port check if you know that ports open. It's clearly a hack-fix and only a temporary solution.
On line 47 of shopify-cli\lib\project_types\extension\commands\serve.rb
Replace
def find_available_port(runtime_configuration)
return runtime_configuration unless specification_handler.choose_port?(@ctx)
chosen_port = Tasks::ChooseNextAvailablePort
.call(from: runtime_configuration.port)
.unwrap { |_error| @ctx.abort(@ctx.message("serve.no_available_ports_found")) }
runtime_configuration.tap { |c| c.port = chosen_port }
end
with
def find_available_port(runtime_configuration)
puts 'Hack fix is in place.'
return runtime_configuration
end
If you've edited the correct file you should see "Hack fix is in place." in the terminal when you run 'shopify extension serve', and hopefully it works.
This is an accepted solution.
Try changing shopify-cli\lib\project_types\extension\commands\serve.rb from:
def find_available_port(runtime_configuration)
return runtime_configuration unless specification_handler.choose_port?(@ctx)
chosen_port = Tasks::ChooseNextAvailablePort
.call(from: runtime_configuration.port)
.unwrap { |_error| @ctx.abort(@ctx.message("serve.no_available_ports_found")) }
runtime_configuration.tap { |c| c.port = chosen_port }
end
to:
def find_available_port(runtime_configuration)
puts "Hack fix is in place."
return runtime_configuration
end
this works well.
I know it's a work around but would be nice to have an official fix as everytime i update Shopify CLI i need to edit this bit.
Can this be merged into github?
Hmm, strange that the hack no longer works. It doesn't look like they've changed anything related in the serve.rb file.
I have a pull request out, but it's not been merged.
Also - I've since switched to a new dev computer and the problem has resolved itself. Both machines use Windows 10, etc... but the underlying problem has something to do with system configuration.
guide me to find this file
The file I changed is located at "C:\Ruby30-x64\lib\ruby\gems\3.0.0\gems\shopify-cli-2.1.0\lib\project_types\extension\commands\serve.rb" for me.
I'm on windows.
To find where your gems are installed run "gem env" in console and find GEM PATHS. For reference, my gem path is "C:/Ruby30-x64/lib/ruby/gems/3.0.0".
Also run "shopify version" in console and make sure you're updating the correct Shopify-CLI gem.
We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024