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 app init just hangs, it's neither completing nor throwing an error #4869

Open
2 tasks done
i-haz-teh-codez opened this issue Nov 15, 2024 · 8 comments
Open
2 tasks done
Labels

Comments

@i-haz-teh-codez
Copy link

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?

App

Expected behavior

Command shopify app init should either set up a new app or return an error.

Actual behavior

The command just hangs. No response for 30+ minutes. Neither a new app is set up nor an error returned.

I asked for assistance on StackOverflow. Here's the link to the question.

Verbose output

See 'Actual behavior' above. No output is being returned.

Reproduction steps

  1. Install NVM (0.40.1)
  2. Install Node LTS (22.11.0) with NPM (10.9.0)
  3. Install Shopify CLI (3.70.0) globally
  4. Run shopify app init

Operating System

Ubuntu 22.04

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

3.70.0

Shell

bash

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

22.11.0

What language and version are you using in your application?

Node 22.11.0

@i-haz-teh-codez i-haz-teh-codez added the Type: Bug Something isn't working label Nov 15, 2024
@isaacroldan
Copy link
Contributor

Hi @i-haz-teh-codez, seems like the CLI hangs during Installing dependencies... which is the CLI shelling out to npm to install the template dependencies. Can you try the same command with the --verbose flag and post the output here?

Also, could you try maybe with a different package manager and/or node version?

@i-haz-teh-codez
Copy link
Author

i-haz-teh-codez commented Nov 18, 2024

Ah, there's a --verbose flag I was unaware of. But I'm not seeing how it changes anything. I mean, you've nailed where the problem is (hanging at "Installing dependencies with NPM...") which is where the verbose output ends and the hanging starts. In other words, there's no more verbose output after that installing dependencies stage — the verbosity ends right there.

Also what's the point of switching to a different package manager when it's supposed to work with LTS Node? By the way, I got it to work with Node 20.18.0 but surely that's not ideal — it should be working with the latest stable Node 22.11.0?

Anyway, here's the --verbose output. I updated my question on StackOverflow with the logs but was unable to link to the photos here (hotlinking error). Check them out there.

@i-haz-teh-codez
Copy link
Author

I retried again in a separate terminal window. Still hanging even right now, almost 2 hours later. Here's the --verbose output:

Here are the relevant first lines...

Image

And the relevant last lines...

Image

@isaacroldan
Copy link
Contributor

Also what's the point of switching to a different package manager when it's supposed to work with LTS Node?

Just trying to pin down where the issue is. I tried with node 22, npm and linux and it worked for me 🤔

I assume that running npm install in any other project works as expected?

Could you check in the folder from the verbose log: /tmp/..../app and see if it actually installed the dependencies and just failed to report it?
If it didn't, can you try running npm install in that directory and see if it works? (maybe is a permissions issue?)

Sorry I don't have more concrete answers, but I can't reproduce the issue

@i-haz-teh-codez
Copy link
Author

OK.

I reported that I actually got it working with a lower version of Node. Also I mentioned that's not ideal since I'm supposed to simply run shopify app init and everything should be set up flawlessly.

But now I have to use tricks like downgrading Node or setting things up manually in /tmp when I'm not supposed to be doing all that (even though I'm technically able to). If anything, I was only reporting the CLI is neither completing running the command nor throwing an error. It just hangs — no verbose output, no error — nothing.

I actually opened a new terminal window and attempted the command again minutes after your first comment. Well, that command is still hung up at "Installing dependencies with npm ..." even at this very moment, near 3 hours later.

@i-haz-teh-codez
Copy link
Author

Update: In my last comment I mentioned I ran the command again in another terminal window and left it hung up there. I came back to check and apparently the command exited 9 hours later. Here are the logs, and notice I left the command hung up at 12:31 and received a response at 21:11.

Image

Image

Image

Image

Again, I was only reporting a bug. The CLI hanging and responding 9 hours later obviously isn't the intended behavior.

@amcaplan
Copy link
Contributor

The code you're running is here:

{
title: `Installing dependencies with ${packageManager}`,
task: async () => {
await getDeepInstallNPMTasks({from: templateScaffoldDir, packageManager})
},
},
{
title: 'Cleaning up',
task: async () => {
await cleanup(templateScaffoldDir)
},
},

getDeepInstallNPMTasks really just runs npm install, see here:

export async function getDeepInstallNPMTasks({
from,
packageManager,
}: {
from: string
packageManager: PackageManager
}): Promise<void> {
/**
* Installation of dependencies using Yarn on Windows might lead
* to "EPERM: operation not permitted, unlink" errors when Yarn tries
* to access the cache. By limiting the network concurrency we mitigate the
* error:
*
* Failing scenario: https://github.com/Shopify/cli/runs/7913938724
* Reported issue: https://github.com/yarnpkg/yarn/issues/7212
*/
const args = platform() === 'win32' && packageManager === 'yarn' ? ['--network-concurrency', '1'] : []
return installNodeModules({directory: normalizePath(from), packageManager, args})
}

It looks like npm install actually took 9 hours. I'm clueless as to why, but it's not something the CLI can control.

If you'd like to confirm, you can do this again and scan running processes for npm install (ps aux | grep npm).

@jakeshivers
Copy link

I am having the exact same problem. Is the solution really to wait for 9 hours?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants