"netlify deploy" hangs

I’m trying to deploy an app to Netlify that is not in a GitHub repo. Here is what I tried:

  • npm install -g netlify-cli
  • netlify deploy
  • select “Create & configure a new site”
  • select a team name (the one associated with my account)
  • enter a site name

Here is what I see:

Site Created

Admin URL: Netlify App
URL: https://svelte-dogs2.netlify.com
Site ID: 1f9e2a6d-e6c0-4475-83f1-e93306cc62ea
Deploy path: /Users/mark/Documents/programming/languages/javascript/svelte/svelte-dogs/.netlify/build
Deploying to draft URL…
:heavy_check_mark: Finished hashing 0 files
:heavy_check_mark: CDN requesting 0 files
:heavy_check_mark: Finished uploading 0 assets
◍ Waiting for deploy to go live…

Then it hangs forever. What could I be doing wrong?

Hi, welcome!

Is this applicable to what you are seeing? There might be something useful in here.

if that doesn’t help, let us know and we’ll do some more digging. :slight_smile:

No. My build process completes in less than 5 seconds.

When debugging the CLI, best thing to do is turn on debug logging. You can do this with by setting a $DEBUG environment variable to the value * before running the command that hangs.

Then, you can send us the log but PLEASE be very careful to remove your API token from the log - that is like your password and should never be shared in public!

Here is what I see now when I enter “netlify deploy” in the directory of my web app.
I see an “Error: Not Found”, but I don’t know what it can’t find.

:running_man: netlify deploy

  @oclif/config reading core plugin /usr/local/lib/node_modules/netlify-cli +0ms
  @oclif/config loadJSON /usr/local/lib/node_modules/netlify-cli/package.json +0ms
  @oclif/config loadJSON /usr/local/lib/node_modules/netlify-cli/oclif.manifest.json +2ms
  @oclif/config:netlify-cli using manifest from /usr/local/lib/node_modules/netlify-cli/oclif.manifest.json +0ms
  @oclif/config reading user plugins pjson /Users/mark/.local/share/netlify-cli/package.json +0ms
  @oclif/config loadJSON /Users/mark/.local/share/netlify-cli/package.json +2ms
  @oclif/config loading plugins [
  '@oclif/plugin-not-found',
  '@oclif/plugin-plugins',
  '@oclif/plugin-help'
] +0ms
  @oclif/config reading core plugin /usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/plugin-not-found +0ms
  @oclif/config loadJSON /usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/plugin-not-found/package.json +2ms
  @oclif/config reading core plugin /usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/plugin-plugins +0ms
  @oclif/config loadJSON /usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/plugin-plugins/package.json +0ms
  @oclif/config reading core plugin /usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/plugin-help +0ms
  @oclif/config loadJSON /usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/plugin-help/package.json +0ms
  @oclif/config loadJSON /usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/plugin-not-found/oclif.manifest.json +2ms
  @oclif/config loadJSON /usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/plugin-plugins/oclif.manifest.json +0ms
  @oclif/config loadJSON /usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/plugin-help/oclif.manifest.json +1ms
  @oclif/config:@oclif/plugin-not-found using manifest from /usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/plugin-not-found/oclif.manifest.json +0ms
  @oclif/config:@oclif/plugin-plugins using manifest from /usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/plugin-plugins/oclif.manifest.json +0ms
  @oclif/config:@oclif/plugin-help using manifest from /usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/plugin-help/oclif.manifest.json +0ms
  @oclif/config config done +7ms
  @oclif/config start init hook +1ms
  netlify:netlify-cli:hooks:init start /usr/local/lib/node_modules/netlify-cli/src/hooks/init +0ms
  netlify:netlify-cli:hooks:init done +31ms
  @oclif/config init hook done +162ms
  netlify init version: @oclif/command@1.5.19 argv: [ 'deploy' ] +0ms
  @oclif/config runCommand deploy [] +4ms
  @oclif/config:netlify-cli require /usr/local/lib/node_modules/netlify-cli/src/commands/deploy.js +176ms
  @oclif/config start prerun hook +861ms
  @oclif/config prerun hook done +1ms
  netlify options: {
  netlify   userAgent: 'netlify/js-client',
  netlify   scheme: 'https',
  netlify   host: 'api.netlify.com',
  netlify   pathPrefix: '/api/v1'
  netlify } +0ms
  netlify Setting access token +0ms
  @oclif/config start analytics hook +7ms
  netlify:netlify-cli:hooks:analytics start /usr/local/lib/node_modules/netlify-cli/src/hooks/analytics +0ms
  netlify:netlify-cli:hooks:analytics done +5ms
  @oclif/config analytics hook done +5ms
  netlify:open-api path template: https://api.netlify.com/api/v1/sites/{site_id} +0ms
  netlify:open-api replacing {site_id} with API-TOKEN +1ms
  netlify:open-api bodyType: json +0ms
  netlify:open-api specialHeaders: {} +0ms
  netlify:open-api method: GET +0ms
  netlify:open-api Rate limit attempt 0 for https://api.netlify.com/api/v1/sites/API-TOKEN +1ms
  netlify:open-api requesting https://api.netlify.com/api/v1/sites/API-TOKEN +0ms
  netlify:open-api fetch done +2s
  netlify:open-api response contentType: application/json; charset=utf-8 +0ms
  netlify:open-api parsing json +0ms
Error: Not Found
    at Object.error (/usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/errors/lib/index.js:22:17)
    at DeployCommand.error (/usr/local/lib/node_modules/netlify-cli/node_modules/@oclif/command/lib/command.js:57:23)
    at DeployCommand.run (/usr/local/lib/node_modules/netlify-cli/src/commands/deploy.js:69:14)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Hey there! Could you please try the following and see if it helps?

# unlink the site from Netlify
netlify unlink

# relink the site to Netlify
netlify link

# link will give you options on how to find which Netlify site you're deploying

# try the deploy again
netlify deploy

For additional context, it looks like the CLI is failing to find a site ID (relevant source code), so what this does is reestablish a link to the site — which should (hopefully!) fix the deploys.

1 Like

I might be misunderstanding something about how the Netlify CLI is supposed to work. The scenario I’m trying to exercise is where the web app is not in a repository like GitHub, but is just a set of local files. In that case is it still necessary to run “netlify link”?

I’m writing the book “Svelte and Sapper in Action” for Manning. I have a chapter on deployment options where I’m trying to describe the basics of deploying web apps to Netlify.

BTW, I’ve been enjoying watching “Learn with Jason” videos!

Hey there! The CLI doesn’t need to be connected to a Git repo, but it does need to be connected to a Netlify site. You can create that site using the CLI with netlify init or through the app.netlify.com UI and link it with netlify link.

Thanks for watching! And I’m looking forward to seeing the book!

I think one issue is that I was trying to manually deploy a site that actually was in GitHub.
I copied the directory for that site to a new directory and deleted the .git directory.
Then I entered “netlify init”, selected “Yes, create and deploy site manually”, selected my team, and entered a site name. That gave me the following output:

Site Created

Admin URL: Netlify App
URL: https://svelte-dogger.netlify.com
Site ID: 42853272-f7b9-46ef-8902-3d598a52e11d
“svelte-dogger” site was created

After this I see the site at Netlify App. I’m guessing that means I don’t need to run “netlify link”, right?

Then I entered “netlify deploy” with DEBUG set to “*” and got the following output that just loops forever.
I had to replace “http” with “{PROTOCOL}” so I could submit this reply without it saying I included too many links.

:waning_gibbous_moon: Waiting for deploy to go live… netlify:open-api fetch done +5s
netlify:open-api response contentType: application/json; charset=utf-8 +0ms
netlify:open-api parsing json +0ms
:waxing_crescent_moon: Waiting for deploy to go live… netlify:open-api path template: {PROTOCOL}://api.netlify.com/api/v1/sites/{site_id}/deploys/{deploy_id} +1s
netlify:open-api replacing {site_id} with {TOKEN} +0ms
netlify:open-api replacing {deploy_id} with {TOKEN} +0ms
netlify:open-api bodyType: json +0ms
netlify:open-api specialHeaders: {} +0ms
netlify:open-api method: GET +0ms
netlify:open-api Rate limit attempt 0 for {PROTOCOL}://api.netlify.com/api/v1/sites/{TOKEN}/deploys/{TOKEN} +0ms
netlify:open-api requesting {PROTOCOL}://api.netlify.com/api/v1/sites/{TOKEN}/deploys/{TOKEN} +0ms
:new_moon: Waiting for deploy to go live… netlify:open-api fetch done +3s
netlify:open-api response contentType: application/json; charset=utf-8 +0ms
netlify:open-api parsing json +0ms
:full_moon: Waiting for deploy to go live… netlify:open-api path template: {PROTOCOL}://api.netlify.com/api/v1/sites/{site_id}/deploys/{deploy_id} +1s
netlify:open-api replacing {site_id} with {TOKEN} +0ms
netlify:open-api replacing {deploy_id} with {TOKEN} +0ms
netlify:open-api bodyType: json +0ms
netlify:open-api specialHeaders: {} +0ms
netlify:open-api method: GET +1ms
netlify:open-api Rate limit attempt 0 for {PROTOCOL}://api.netlify.com/api/v1/sites/{TOKEN}/deploys/{TOKEN} +0ms
netlify:open-api requesting {PROTOCOL}://api.netlify.com/api/v1/sites/{TOKEN}/deploys/{TOKEN} +0ms

I just ran this myself to see if I could duplicate the problem, and I think I know what’s happening

when you run netlify deploy, it’s going to default to /.netlify/build as the published directory — I just tried this and it hung:

$ netlify deploy
Deploy path: /Users/boop/manual-deploy-test/.netlify/build
Deploying to draft URL...
✔ Finished hashing 0 files
✔ CDN requesting 0 files
✔ Finished uploading 0 assets
[==  ] Waiting for deploy to go live...

I added the -d option and specified the current directory and it deployed right away:

$ ntl deploy --prod -d .
Deploy path: /Users/boop/manual-deploy-test
Deploying to live site URL...
✔ Finished hashing 1 files
✔ CDN requesting 0 files
✔ Finished uploading 0 assets
✔ Deploy is live!

Logs:              https://app.netlify.com/sites/manual-deploy-test/deploys/5e323b0dd4dbade79d7081b7
Unique Deploy URL: https://5e323b0dd4dbade79d7081b7--manual-deploy-test.netlify.com
Live URL:          https://manual-deploy-test.netlify.com

could you give this a shot and see how it goes?

thanks!

1 Like

That was it! But in my case I need “-d public” because that is where Svelte places the files to be deployed.

Thanks so much for helping me through this! You can close this now, though I’m thinking even without the “-d” it should have output some sort of error message instead of looping forever.

1 Like

where do you set this variable?

This is set in the shell environment. For example, if you just want to see it for one command, that can be done on the same line as the command itself.

For example, say the command you are testing is this:

netlify deploy --prod -d public

You can set that environment variable for just the one command by appending it like so:

DEBUG='*' netlify deploy --prod -d public

If there are other questions, please reply anytime.