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.
CodePudding user response:
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
CodePudding user response:
error says your system does not have the necessary dependencies to run the create command. clean install first
npm install -g @sveltejs/kit
also check version,
node --version
npm --version
If not current then ;
npm install -g npm
node --version