Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

SyntaxError: Cannot use import statement outside a module #287

Open
PwrSrg opened this issue Mar 22, 2022 · 11 comments
Open

SyntaxError: Cannot use import statement outside a module #287

PwrSrg opened this issue Mar 22, 2022 · 11 comments

Comments

@PwrSrg
Copy link

PwrSrg commented Mar 22, 2022

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

@dummdidumm
Copy link
Member

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

@Conduitry
Copy link
Member

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

@Conduitry Conduitry transferred this issue from sveltejs/svelte Mar 22, 2022
@PwrSrg
Copy link
Author

PwrSrg commented Mar 22, 2022

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

I will update this post as I discover more.

@jweathers
Copy link

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.

@mscrocdile
Copy link

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

@Conduitry
Copy link
Member

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

@mscrocdile
Copy link

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.

@jasonlyu123
Copy link
Member

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?

@Chaciej
Copy link

Chaciej commented Apr 12, 2022

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

@DonTomato
Copy link

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.

@DonTomato
Copy link

@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 🤡

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

No branches or pull requests

8 participants