vite: Uncaught (in promise) TypeError: crypto.randomBytes is not a function

Viewed 308

How the problem arises: Access to vite in the project, an error is reported when running vite

Error corresponding file: return crypto.randomBytes(Math.ceil(len / 2)).toString('hex').slice(0, len); //This line reports an error in /node_modules/.vite/unique-string.js

Run framework, version: vue2.6.12、vue-cli4、vite2.5.5 (The latest version does not work too)

Ask for advice~~

0 Answers
Related