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

Build and deploy issues with Netlify #12037

Closed
brittneypostma opened this issue Mar 25, 2024 · 3 comments
Closed

Build and deploy issues with Netlify #12037

brittneypostma opened this issue Mar 25, 2024 · 3 comments

Comments

@brittneypostma
Copy link
Contributor

Describe the bug

Even when creating a new create svelte app, I am unable to deploy to Netlify unless I use adapter-static. I have tried adapter-auto, adapter-netlify, and can only get adapter-static to actually build and deploy. I get the error no build directory has been found when running ntl build and then ntl deploy with the CLI. I can confirm, it is not creating a build directory, but I'm unsure why. Just running pnpm build and pnpm preview works.

I'm unsure if this is an adapter-netlify issue or if it is something else.

Reproduction

Cannot reproduce this because you need an access token for Netlify login. Locally if you have a Netlify account, you can install the cli with npm i -g netlify-cli, then run ntl login, then ntl init to create the site, then ntl build, then ntl deploy.

Logs

good!

(build.command completed in 6.2s)

Save updated config                                           
────────────────────────────────────────────────────────────────


(options.onEnd completed in 2ms)

Netlify Build Complete                                        
────────────────────────────────────────────────────────────────

(Netlify Build completed in 6.2s)
🍺  brittney.postma ntl deploy
Deploy path:        craft/packages/test/build
Configuration path: craft/packages/test/netlify.toml
 ›   Error: The deploy directory "/Users/brittney.postma/coding/craft/packages/test/build" has not been found. Did you forget to run 'netlify build'?


netlify.toml

[build]
publish = "/packages/testbuild"
base = "/packages/test"
command = "pnpm build"

[functions]
directory="functions"

System Info

System:
    OS: macOS 14.3
    CPU: (10) arm64 Apple M1 Max
    Memory: 159.39 MB / 32.00 GB
    Shell: 3.2.57 - /bin/sh
  Binaries:
    Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
    pnpm: 8.15.4 - ~/Library/pnpm/pnpm
    bun: 1.0.25 - ~/.bun/bin/bun
  Browsers:
    Chrome: 123.0.6312.58
    Safari: 17.3
  npmPackages:
    @sveltejs/adapter-auto: ^3.0.0 => 3.1.1 
    @sveltejs/kit: ^2.0.0 => 2.5.4 
    @sveltejs/package: ^2.0.0 => 2.3.0 
    @sveltejs/vite-plugin-svelte: ^3.0.0 => 3.0.2 
    svelte: ^4.2.7 => 4.2.12 
    vite: ^5.0.11 => 5.2.3 


### Severity

blocking an upgrade

### Additional Information

I cannot build in anything server rendered while this issue persists.
@eltigerchino
Copy link
Member

I'm able to build and deploy using the commands below. Does this work on your end?

mkdir test-app && cd test-app
ntl init
pnpm create svelte . && pnpm i
ntl build
NETLIFY=1 ntl deploy

Please provide a publish directory (e.g. "public" or "dist" or "."):
? Publish directory (.) build

@brittneypostma
Copy link
Contributor Author

I'm able to build and deploy using the commands below. Does this work on your end?

mkdir test-app && cd test-app
ntl init
pnpm create svelte . && pnpm i
ntl build
NETLIFY=1 ntl deploy

Please provide a publish directory (e.g. "public" or "dist" or "."):
? Publish directory (.) build

Yes, adapter auto isn't picking up the Netlify env from my settings, however that isn't the only issue I'm running into. This works on a base site, but on my private site I am getting a 404 if I don't prerender all the routes. This may be a completely separate issue, but I am at my wits end trying to debug it. I even went back to a clean branch I know deployed before and it still 404s.

@brittneypostma
Copy link
Contributor Author

I resolved this issue. Turns out Netlify's UI was not configuring the site correctly for the workspace. It was putting my serverless functions inside my package like it was at the root, prefixing the directories twice. By removing the old version of adapter-netlify and reinstalling version 4.1.0 then adding a netlify.toml to force Netlify to put the functions in the correct directory, the site finally builds without a 404.

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

No branches or pull requests

2 participants