TypeError: crypto.hash is not a function | Dev Server not starting #20411
shivam28singh
started this conversation in
Feedback
Replies: 7 comments 5 replies
|
same error getting on running the react project |
0 replies
|
same here on nuxt bun 1.2.18 {
"name": "nuxt-app",
"type": "module",
"private": true,
"scripts": {
"build": "nuxt generate",
"dev": "nuxt dev --host",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@internationalized/date": "^3.8.2",
"@nuxt/eslint": "1.3.1",
"@nuxt/fonts": "0.11.4",
"@nuxt/icon": "1.12.0",
"@nuxt/test-utils": "3.18.0",
"@nuxtjs/i18n": "9.5.4",
"@pinia/nuxt": "^0.11.1",
"@tailwindcss/vite": "^4.1.11",
"@unhead/vue": "^2.0.12",
"@vite-pwa/nuxt": "1.0.4",
"dotenv": "^17.2.0",
"eslint": "^9.31.0",
"module": "^1.2.5",
"nuxi": "^3.26.2",
"nuxt": "^4.0.0",
"pinia": "^3.0.3",
"reka-ui": "^2.3.2",
"tailwindcss": "^4.1.11",
"tsx": "^4.20.3",
"typescript": "^5.8.3",
"vaul-vue": "^0.4.1",
"vite": "^7.0.4",
"vue": "^3.5.17",
"vue-router": "^4.5.1",
"zod": "^4.0.5"
},
"devDependencies": {
"@antfu/eslint-config": "^4.17.0",
"@iconify-json/lucide": "^1.2.57",
"@nuxt/devtools": "^2.6.2",
"@vueuse/nuxt": "13.2.0",
"eslint-plugin-format": "^1.0.1"
}
}delete node_modules and lock nothing happens |
0 replies
|
Resolution in my case: I was building in CodeBuild (Amazon Linux 2), and the image hasn't been updated in a while to include newer versions of Node. Vite 7 requires a relatively recent version of Node 20 / Node 22, so I added Perhaps you're facing a similar issue locally? |
2 replies
|
I had the same issue in my local environment. Changing my node version to 22.17.1 also resolved the problem for me. |
1 reply
|
i also got the same error , but it got fixed using node verson 20.19.0 or above -> i hope it helps |
0 replies
|
Latest Vite requires node v22.17.1. Check and upgrade your node version |
0 replies
|
So how does bun fix this? |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I am facing issue while starting a dev server using vite(7.0.4).
TypeError: crypto.hash is not a functionI researched and found browsers doesn't support crypto.hash function so tried to use polyfills. In the vite.config.js file, I have mentioned the fallback library "crypto-browserify" but it still shows the same error.
error when starting dev server: TypeError: crypto.hash is not a function at getHash (file:///D:/NewsFeedSystem/node_modules/vite/dist/node/chunks/dep-DZ2tZksn.js:2788:21) at getLockfileHash (file:///D:/NewsFeedSystem/node_modules/vite/dist/node/chunks/dep-DZ2tZksn.js:11673:9) at getDepHash (file:///D:/NewsFeedSystem/node_modules/vite/dist/node/chunks/dep-DZ2tZksn.js:11676:23) at initDepsOptimizerMetadata (file:///D:/NewsFeedSystem/node_modules/vite/dist/node/chunks/dep-DZ2tZksn.js:11137:53) at createDepsOptimizer (file:///D:/NewsFeedSystem/node_modules/vite/dist/node/chunks/dep-DZ2tZksn.js:34586:17) at new DevEnvironment (file:///D:/NewsFeedSystem/node_modules/vite/dist/node/chunks/dep-DZ2tZksn.js:35350:109) at Object.defaultCreateClientDevEnvironment [as createEnvironment] (file:///D:/NewsFeedSystem/node_modules/vite/dist/node/chunks/dep-DZ2tZksn.js:35769:9) at _createServer (file:///D:/NewsFeedSystem/node_modules/vite/dist/node/chunks/dep-DZ2tZksn.js:28344:132) at async CAC.<anonymous> (file:///D:/NewsFeedSystem/node_modules/vite/dist/node/cli.js:573:18)All reactions