0

When I try to use npm create svelte@latest to create a SvelteKit app it won't work when using VS Code with SSH.

The SSH server I'm connected to runs Ubuntu 20.04.2 on 64 bit Intel hardware.

When I try to use npm create svelte@latest . to initialize a SvelteKit project it outputs an error:

import fs from 'fs';
       ^^

SyntaxError: Unexpected identifier
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

Any way to fix this? I would appreciate any help.

3
  • What is the output of node --version? You'll want to be on at least around 12, but 18 is a good bet. Commented Dec 4, 2022 at 20:35
  • @ZacAnger v10.19.0 Commented Dec 4, 2022 at 20:39
  • See my answer — you're gonna have to update, and because Ubuntu 20 doesn't have a recent version of Node, you'll have to do it with a third-party package. nvm and n work pretty well. Commented Dec 4, 2022 at 20:43

1 Answer 1

1

You need to update Node. The latest in Ubuntu 20 is v10, which is very outdated. If you're not in a position to update your system to Jammy or Kinetic, you can use nvm another version manager to get yourself up to date. Personally I like n:

npm i -g n
n stable
Sign up to request clarification or add additional context in comments.

1 Comment

Updating fixed the issue. It took a while but it worked! Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.