-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Issue] Cannot redefine property: crypto #10252
Comments
I cannot reproduce it with the default template with Node 16.15.0. We'll need a complete reproduction if you've made any modifications to the template. |
@gtm-nayan - No, I didn't make any modification to the template |
@gtm-nayan - these options I selected while setting up repo |
I also have this same error, but only after adding few dependencies to the template and on existing projects with templates. When I remove the dependencies I've added, the error stays (even after delete package locks, node_modules and .sveltekit dir). Which makes no sense to me. My stack is different pnpm (or npm), Node 18, MacOS, with Typescript. I'm trying to figure which dependencies it is - perhaps multiple version sof sveltekit being pulled in. |
I suddenly got this error too - was working on friday, not working today. Also persists through deletion of package-lock and node_moduls |
Have same issue with node v16.19.0 but Fixed this by updating to lates node v20.3.1. |
@AntonPavlenkov - Thank you very much. The latest node v20.3.1 resolved the issue for me. |
@gtm-nayan Is there any update on this one? I can not rely on updating version to 20.3.1 Other things might break. |
You update only your local machine for development with node 20. Build with version 16 is fine and deploying to docker with node 16 is also working fine. Although you are correct that it needs to be resolved properly. |
Also broken on node 18.15 |
Unfortunately I cannot reproduce the problem myself and I can't really investigate the problem with being able to recreate it. If you can't change the major version see if an upgrade or downgrade within the same major helps. |
I can't reproduce this either. I've installed Node 16.15.0 on a fresh Windows 11 sandbox, and I'm not getting this error with the default template. |
Broken on NodeJS Updated to NodeJS |
I'm unable to reproduce this on Node 18.14.0 on Windows 11 either. |
@DoisKoh @dagthomas @AntonPavlenkov Have you freshly installed the node on your system or it was previously installed? |
I had an ongoing project, everything was previously installed. Happened from Friday to Monday where it didn't work anymore, unless I installed node 20 |
It was installed before and was working fine until Monday. Although I use nvm on Mac m1 for that matter. |
This happened to me today as well. Deleting This is on Mac 13.0.1 (22A400), Node 18.16.0, pnpm 8.4.0. The steps taken were hard track. I can provide UPDATE: happens again after machine reboot. |
This is hard to reproduce I’ve failed even though I’ve hit it on several projects (starting from clean and from existing). Whilst it’s not addressing the issue should the install polyfill check if crypto etc is already defined? or try-catch and log a warning? It currently just overwrites everything on globalThis as far as I can see. |
Have had exactly the same experience on Windows 11, WSL2 (
Working fine last night (approx 21:00 BST). Only obvious moving pieces on my system:
Given this effects MacOS users, too, I can't think these are relevant. As with others, upgrading Node (to |
I and other collaborators are having the same issue. As with other posts mentioned above, it happened overnight with no discernable change. It's a weird case to reproduce or not - hard to pinpoint how and why it happens, or how and why it doesn't happen. turbo: 1.10.6,
@sveltejs/kit: ^1.15.8,
vite: ^4.2.1,
node 18.16.1
Ubuntu 22.04.2 LTS Switching to node |
this post related the same issue https://stackoverflow.com/questions/76557205/why-wont-vite-server-start |
Same issue with Node.js v18.13.0. Worked last night! |
same error on node v18.16.1 |
* fixes crypto polyfill bug sveltejs/kit#10252
To everyone affected by this: Do you have the "Console Ninja" extension installed by any chance? If so, this might be the culprit, as hinted by this related issue. If so, try updating the extension to the latest version, then delete your node modules folder in the offending project and reinstall the packages, which hopefully fixes this. |
Actually I do have it "Console Ninja" installed. So after uninstalling it and trying again it did not work. Also from trying to start it from pure terminal without IDE it also does not work. |
@AntonPavlenkov can you try again after removing the node_modules and doing a force install? |
@gtm-nayan yes! So after uninstalling Console Ninja and removing node_module and package.lock and .svelte-kit and running fresh install. The error goes away. But it is enough to just install Console Ninja again and error comes back! So the question is... where we should expect fix to come from svelte-kit or from console-ninja? |
I am using Console Ninja, yes. I have upgraded it to I am now able to start Vite Server just fine on Node Thank you for identifying this resolution so quickly. |
Same here, upgrading to the latest Console Ninja > @N-NeelPatel that should solve the issue |
Wow great find! Just updated Console Ninja to v0.0.170 and removed my node_modules and did a fresh install. Seems to be resolved now, thank you! |
Closing this since the issue was external and is now fixed. For future googlers -- upgrade Console Ninja, remove |
possible solution
#10252 (comment)
Describe the bug
When I create a new project in svelte using these commands:
I get this issue

|
Reproduction
When I create a new project in svelte using these commands:
Logs
No response
System Info
Severity
blocking all usage of SvelteKit
Additional Information
No response
The text was updated successfully, but these errors were encountered: