tarojs 3.4.8版本报错

发布于 2022-05-04 17:19:55 阅读 1959

好久没有写博客了,本次来记录一个很诡异的报错。

起因是这样的:我使用的是tarojs这个开发框架,我的几个小程序都是用的这个框架,但是今天准备搞下《我的纪念》小程序的新版本,可是项目启动不了,于是我升级了taro的版本,升级了最新的3.4.8版本,但是项目启动后就报了下面的错误

error:03000086:digital envelope routines::initialization error

于是上网找了下解决办法是是环境变量需要设置一个参数,于是我在项目启动的script添加一个参数

export SET NODE_OPTIONS=--openssl-legacy-provider

这样再run后,确实不报这个错了,项目确实也可以run起来了,但是再build时候,却报了如下的错误

yarn run v1.22.17
$ export SET NODE_OPTIONS=--openssl-legacy-provider && taro build --type weapp
👽 Taro v3.4.8

启动  开发者工具-项目目录  /Users/meow/mywebs/node/tarotemplatefromgiteenorux/dist
生成  工具配置  /Users/meow/mywebs/node/tarotemplatefromgiteenorux/dist/project.config.json

编译  发现入口  src/app.js
编译  发现页面  src/pages/index/index.jsx
🙅   编译失败. 5/4/2022, 2:43:49 PM

app.wxss from CssoWebpackPlugin
You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer Error: You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer
    at async Promise.all (index 0)
    at async Promise.all (index 3)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

这个报错看起来像是框架内部的原因,我先在github的issue中找是否有先关的问题解决办法,可是没有。于是我加了微信群,再群里反馈,也无人回应。

这时我再想是不是我本地的环境有问题?

于是我看了下自己的node版本,发现是最新的18版本,于是我打开了node官方,看到了官方推荐大多数用户使用16.15.0版本,于是我将版本切到了16.15.0,上面的问题也不复存在。

在微信群里看到有人也再吐槽node版本的问题确实坑,好在我使用的是unix系统,可以随意切换node版本,还算简单。