Go Pro Sign Up Login
0 days 0 hrs 0 min 0 sec

Summer Sale

50% off Level Up Pro until you unsubscribe.
Get access to ALL 128 courses on Level Up Tutorials

This is your last chance to get Level Up Pro for $145/year.

or Learn More
Moon Moon

Buy Now and unlock this series

$

49

.99

yours forever

Become a Pro and unlock everything

$

24

.99

per month

Static Site Generation and Adapters

Here we will look at adding an adapter and building what we have so that we can get it ready to deploy and be hosted.

npx ncu -i
npm install --save-dev @sveltejs/adapter-static@next
npm run build

Downloads

Become a pro to download code and videos

Comments

Ronny

3 months ago

I was getting only js files when I tried to build. I saw a red 404 message in the console::

404 /posts/Goodbye (linked from /posts)

I renamed my goodbye.md to goodbye.md.bak, then ran again and got the same 404 but for /posts/Hello. So I renamed hello.md to hello.md.bak and tried building again. This time it looked like it built correctly and I managed to get to the step where we use npx serve.

I'm not sure what to make of this yet but removing those two MD files allowed me to move on for the time being. It's a bandaid for anyone who's stuck here.

J

5 months ago

Not working for me with static adapter @1.0.0-next.29. It does not generate any static files – only .js

Jorne

8 months ago

I'm getting this error: Using @sveltejs/adapter-static undefined TypeError: Cannot read properties of undefined (reading 'path')

500 /posts/goodbye (linked from /posts)

User avatar

Raul

about 1 year ago

@I can't continue from here Please try this: npm install --save-dev @sveltejs/adapter-static@next

User avatar

I can't continue from here

about 1 year ago

Hi, it gives me this error when I do the npm command:

$ npm install —save-dev @sveltejs/adapter-static@next 1 ↵ npm ERR! arg Argument starts with non-ascii dash, this is probably invalid: —save-dev npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name "—save-dev": Tags may not have any characters that encodeURIComponent encodes.

Joe Astuccio

about 1 year ago [edited]

Thanks @Raul! I should have posted my solution. I installed "npm-check-updates" globally first.

npm install -g npm-check-updates

User avatar

Raul

about 1 year ago

@Joe Astuccio I can replicate your issue! An alternative is to install the correct one locally instead of running it with npx

Joe Astuccio

about 1 year ago

I am getting an issue with npx ncu -i That command returns National Central University Taiwan's weather info instead of npm-check-updates package.

https://www.npmjs.com/package/ncu-weather https://www.npmjs.com/package/npm-check-updates

Want to join the conversation?

Become a Pro member today!