gpt4 book ai didi

Nuxt2 doesn't work with latest LTS of node (v18)(Nuxt2不支持最新的节点LTS(V18))

转载 作者:bug小助手 更新时间:2023-10-28 11:40:52 46 4
gpt4 key购买 nike



I'm newbie and this my first vuejs project using nuxt.
I running command by "npm run dev" in CMD, after run command "npm install" for my project and got this:

我是新手,这是我第一个使用nuxt的vuejs项目。我在CMD中运行命令npm run dev,在为我的项目运行命令npm Install之后,得到了以下结果:


* Client █████████████████████████ building (10%) 1/2 modules 1 active
node_modules\webpack-hot-middleware\client.js

* Server █████████████████████████ building (10%) 1/1 modules 0 active


node:internal/crypto/hash:71
this[kHandle] = new _Hash(algorithm, xofLen);
^ttp://localhost:3000/ │
│ │
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10) 07:49:12
at module.exports (C:\Users\a\revampkiriminaja\kiriminaja\node_modules\webpack\lib\util\createHash.js:135:53) 07:49:12
at NormalModule._initBuildHash (C:\Users\a\revampkiriminaja\kiriminaja\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (C:\Users\a\revampkiriminaja\kiriminaja\node_modules\webpack\lib\NormalModule.js:471:10)
at C:\Users\a\revampkiriminaja\kiriminaja\node_modules\webpack\lib\NormalModule.js:503:5
at C:\Users\a\revampkiriminaja\kiriminaja\node_modules\webpack\lib\NormalModule.js:358:12
at C:\Users\a\revampkiriminaja\kiriminaja\node_modules\webpack\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (C:\Users\a\revampkiriminaja\kiriminaja\node_modules\webpack\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at Array.<anonymous> (C:\Users\a\revampkiriminaja\kiriminaja\node_modules\webpack\node_modules\loader-runner\lib\LoaderRunner.js:205:4) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

PS: I am able to run serve and get a working localhost:3000 in my browser.

PS:我可以运行Serve,并在我的浏览器中获得一个有效的本地主机:3000。


更多回答

More context is highly welcome to help you debug this further.

我们非常欢迎更多的上下文来帮助您进一步调试。

Please check which version of Node are you using... Simmilar problem found here: stackoverflow.com/questions/69394632/…

请检查您使用的是哪个版本的Node... Simmilar problem found here:stackoverflow.com/questions/69394632/.

Thanks for responding my question. I've checked nodejs, nuxt and npm version : Node.js v18.12.1, Nuxt @ v2.15.8, npm --version 8.19.2. Am I have to downgrade nodejs, and what the best choice for nuxtjs version? thanks for your help sir

谢谢你回答我的问题。我已经检查了NodeJS、nuxt和NPM版本:Node.js v18.12.1,nuxt@v2.15.8,npm--版本8.19.2。NodeJS是不是必须降级,nuxtjs版本的最佳选择是什么?谢谢您的帮助,先生

Not sure that Nuxt2 is able to run perfectly at Node 18. Try 16 rather. You can also use yarn to maybe have something more verbose.

不确定Nuxt2是否能够在节点18上完美运行。可以试试16。你也可以用纱线来表达一些更冗长的意思。

Thank you. I've just successfully running my nuxtjs project on localhost:3000 by your recommendation.

谢谢在你的推荐下,我刚刚在localhost:3000上成功运行了我的nuxtjs项目。

优秀答案推荐

OP solved the issue by using Node v16, I recommend to use nvm for such purpose btw.

The LTS aka Node.js v18 seems to be too new for Nuxt2.

OP通过使用Node v16解决了这个问题,我建议使用NVM来达到这个目的。对于Nuxt2来说,LTS又名Node.js v18似乎太新了。


PS: using yarn or PNPM will give more verbose feedback overall as of what is happening during your packages installation.

PS:使用YAR或PNPM将提供更详细的总体反馈,以了解在安装包期间发生的情况。



Most of the issues related to ssl or 'digital envelope routines' are fixed in more recent nuxt 2 releases.
Try 2.17.1.
Everything works for me, even on Node v20.

大多数与SSL或“数字信封例程”相关的问题都在较新的nuxt 2版本中得到了修复。尝试2.17.1。一切都适合我,即使在Node v20上也是如此。


更多回答

You should not use Nuxt2 anymore tho, since the EOL for Vue2 is the end of 2023.

不过,您不应该再使用Nuxt2,因为Vue2的下线时间是2023年底。

46 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com