npm run dev启动项目报错如下应该如何解决? INFO Starting development server... 10% building 2/5 modules 3 active ...der\index.js??ref--13-0!F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\src\main.jsError: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:71:19) at Object.createHash (node:crypto:133:10) at module.exports (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\webpack\lib\util\createHash.js:135:53) at NormalModule._initBuildHash (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\webpack\lib\NormalModule.js:417:16) at handleParseError (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\webpack\lib\NormalModule.js:471:10) at F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\webpack\lib\NormalModule.js:503:5 at F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\webpack\lib\NormalModule.js:358:12 at F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\loader-runner\lib\LoaderRunner.js:373:3 at iterateNormalLoaders (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\loader-runner\lib\LoaderRunner.js:214:10) at iterateNormalLoaders (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\loader-runner\lib\LoaderRunner.js:221:10) at F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\loader-runner\lib\LoaderRunner.js:236:3 at runSyncOrAsync (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\loader-runner\lib\LoaderRunner.js:130:11) at iterateNormalLoaders (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\loader-runner\lib\LoaderRunner.js:232:2) at Array.<anonymous> (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\loader-runner\lib\LoaderRunner.js:205:4) at Storage.finished (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16) at F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9 node:internal/crypto/hash:71 this[kHandle] = new _Hash(algorithm, xofLen); ^ Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:71:19) at Object.createHash (node:crypto:133:10) at module.exports (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\webpack\lib\util\createHash.js:135:53) at NormalModule._initBuildHash (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\webpack\lib\NormalModule.js:417:16) at handleParseError (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\webpack\lib\NormalModule.js:471:10) at F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\webpack\lib\NormalModule.js:503:5 at F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\webpack\lib\NormalModule.js:358:12 at F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\loader-runner\lib\LoaderRunner.js:373:3 at iterateNormalLoaders (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\loader-runner\lib\LoaderRunner.js:214:10) at Array.<anonymous> (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\loader-runner\lib\LoaderRunner.js:205:4) at Storage.finished (F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16) at F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9 at F:\NMD_Link_Of_Things\thinglinks\thinglinks-ui\node_modules\graceful-fs\graceful-fs.js:123:16 at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) { opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ], library: 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED' } Node.js v18.16.0
时间: 2023-08-08 22:05:11 浏览: 214
这个错误表明在启动项目时出现了一个加密算法不受支持的问题。可能有几种解决方法:
1. 确保你的 Node.js 版本符合项目的要求。根据你提供的信息,你正在使用 Node.js v18.16.0。可能该项目不支持这个版本。尝试降级到项目所需的版本。
2. 清除 npm 缓存。运行以下命令清除 npm 缓存:
```
npm cache clean --force
```
3. 删除 `node_modules` 目录并重新安装依赖项。运行以下命令:
```
rm -rf node_modules
npm install
```
4. 确保你的项目依赖项是最新的版本。更新项目的依赖项可以解决一些兼容性问题。可以尝试运行以下命令更新所有依赖项:
```
npm update
```
如果以上方法都不能解决问题,你可能需要在项目的 GitHub 页面或开发者社区中寻求帮助,以获取更具体的解决方案。
阅读全文