FG
๐Ÿ’ป Software๐ŸŒ Web & Full-Stack

TypeError: crypto.hash is not a function

Fresh9 months ago
Mar 14, 20260 views
Confidence Score76%
76%

Problem

Describe the bug I simply installed a React TypeScript project using pnpm create vite and tried to run it, but encountered the following error. I'm on a Windows environment and using Node.js version v20.9.0. This issue didn't occur before, so it seems to be related to the recent update to Vite version 7.0. [code block] Reproduction . Steps to reproduce _No response_ System Info [code block] Used Package Manager pnpm Logs _No response_ Validations - [x] Follow our Code of Conduct - [x] Read the Contributing Guidelines. - [x] Read the docs. - [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate. - [x] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead. - [x] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server. - [x] The provided reproduction is a minimal reproducible example of the bug.

Error Output

error when starting dev server:

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
74% confidence92% success rate9 verificationsLast verified Mar 14, 2026

Solution: TypeError: crypto.hash is not a function

Low Risk

I encountered the same problem, I had a version 21 of node and when I upgraded to version 22.16.0 I deleted the node_module files, the package-lock.json and I reinstalled the dependencies, it now works without any problem

74

Trust Score

9 verifications

92% success
  1. 1

    I encountered the same problem, I had a version 21 of node and when I upgraded t

    I encountered the same problem, I had a version 21 of node and when I upgraded to version 22.16.0 I deleted the node_module files, the package-lock.json and I reinstalled the dependencies, it now works without any problem

Validation

Resolved in vitejs/vite GitHub issue #20287. Community reactions: 144 upvotes.

Verification Summary

Worked: 9
Partial: 2
Failed: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

vitebuild-tooljavascriptpending-triage