【vite】启动项目时报错:Cannot find module ‘worker_threads‘

1 篇文章 0 订阅

启动新clone的vue3+vite项目时报如下错误:Cannot find module ‘worker_threads’

Error: Cannot find module 'worker_threads'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/zhaojingjing/work/hnwe/websitenew/node_modules/vite/dist/node/chunks/dep-9c153816.js:25:20)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hnweny@1.0.0 dev: `cross-env NODE_ENV=production vite`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the hnweny@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

在查阅相关资料时发现vite官网有这样一段话:
在这里插入图片描述

使用vite时node版本应为14.6.0以上

node -v查询了本地node版本为10.15.1,遂升级node版本后重新启动,解决!

附:mac系统下升级node版本

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值