sveltejs / template

Template for building basic applications with Svelte

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SyntaxError: Cannot use import statement outside a module

PwrSrg opened this issue · comments

Describe the bug

When testing Svelte for the very first time, it throws an error.

image

Reproduction

npx degit sveltejs/template my-svelte-project
cd my-svelte-project
npm install
npm run dev

Logs

No response

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (12) x64 AMD Ryzen 5 3600X 6-Core Processor
    Memory: 17.89 GB / 31.93 GB
  Binaries:
    Node: 17.7.2 - C:\Program Files\nodejs\node.EXE
    npm: 8.5.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (96.0.1054.57)
    Internet Explorer: 11.0.22000.120

Severity

blocking all usage of svelte

You are using NodeJS Version 17, which may be the cause of this error. It's working fine for me using NodeJS 16.

I'm not seeing this on Node 17.7.2. It works fine for me.

After further debugging, the issue is somehow related to running from a mapped network drive.

I will update this post as I discover more.

I'm having this issue as well. Running node 17 on windows 10. No mapped drives are used in this project. I do not have any mapped drives.

I'm having this issue as well. Running node 16.13.2 on windows 10. No mapped drive.

I've just tested this again on a fresh Windows 10 sandbox, Node 16.13.2, and cannot reproduce it.

I can confirm it works in sandbox.
I can fix that problem if i start "npm run dev" with admin access rights. No idea why.

Maybe it's related to rollup/rollup#4439. Can you check if your path has a different casing between the terminal and the file system?

fresh install, step by step from the site instructions, what's happening?
svelte not working

well... it did install on a second drive and it somehow works
so the issue is with C drive or something with permissions... dunno

edit: managed to install it on C: but strangely works only from deeply nested folders

so the issue is with C drive or something with permissions... dunno

I tried, and it fails with this error on both C, D, etc. I couldn't find such a place where it works.

@jasonlyu123 Yes, that's it. As soon as I changed c:\sources\... for C:\sources\... in my terminal, it started to work.
This is just an insanely stupid bug 🤡