前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >NPM运行保存问题解决

NPM运行保存问题解决

作者头像
云叶知秋
发布2024-02-21 11:42:26
3200
发布2024-02-21 11:42:26
举报
文章被收录于专栏:Unity3D学习笔记

问题描述

我在控制台运行如下命令

代码语言:javascript
复制
npm run dev

结果报出如下错误

代码语言:javascript
复制
> form-generator@0.2.0 dev
> vue-cli-service serve

 INFO  Starting development server...
10% building 4/4 modules 0 active(node:4920) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
10% building 4/6 modules 2 active D:\develop_study\form-generator\node_modules\webpack\hot\dev-server.jsError: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (D:\develop_study\form-generator\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (D:\develop_study\form-generator\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (D:\develop_study\form-generator\node_modules\webpack\lib\NormalModule.js:471:10)
    at D:\develop_study\form-generator\node_modules\webpack\lib\NormalModule.js:503:5
    at D:\develop_study\form-generator\node_modules\webpack\lib\NormalModule.js:358:12
    at D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at iterateNormalLoaders (D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
    at D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:236:3
    at runSyncOrAsync (D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
    at iterateNormalLoaders (D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
    at Array.<anonymous> (D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (D:\develop_study\form-generator\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at D:\develop_study\form-generator\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (D:\develop_study\form-generator\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (D:\develop_study\form-generator\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (D:\develop_study\form-generator\node_modules\webpack\lib\NormalModule.js:471:10)
    at D:\develop_study\form-generator\node_modules\webpack\lib\NormalModule.js:503:5
    at D:\develop_study\form-generator\node_modules\webpack\lib\NormalModule.js:358:12
    at D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at iterateNormalLoaders (D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
    at D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:236:3
    at runSyncOrAsync (D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
    at iterateNormalLoaders (D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
    at Array.<anonymous> (D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (D:\develop_study\form-generator\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at D:\develop_study\form-generator\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
node:internal/crypto/hash:69
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (D:\develop_study\form-generator\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (D:\develop_study\form-generator\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (D:\develop_study\form-generator\node_modules\webpack\lib\NormalModule.js:471:10)
    at D:\develop_study\form-generator\node_modules\webpack\lib\NormalModule.js:503:5
    at D:\develop_study\form-generator\node_modules\webpack\lib\NormalModule.js:358:12
    at D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at Array.<anonymous> (D:\develop_study\form-generator\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (D:\develop_study\form-generator\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at D:\develop_study\form-generator\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
    at D:\develop_study\form-generator\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.19.0

百度了一下,是说版本不对,不是LTS版本,建议我更换Node版本 我本机安装了nvm管理工具,所以通过nvm去查询下node的版本信息

代码语言:javascript
复制
nvm list available
##或者也可以用如下的别名ls来执行
nvm ls available

然后看到如下可以安装的版本信息

代码语言:javascript
复制
|   CURRENT    |     LTS      |  OLD STABLE  | OLD UNSTABLE |
|--------------|--------------|--------------|--------------|
|    21.6.2    |   20.11.1    |   0.12.18    |   0.11.16    |
|    21.6.1    |   20.11.0    |   0.12.17    |   0.11.15    |
|    21.6.0    |   20.10.0    |   0.12.16    |   0.11.14    |
|    21.5.0    |    20.9.0    |   0.12.15    |   0.11.13    |
|    21.4.0    |   18.19.1    |   0.12.14    |   0.11.12    |
|    21.3.0    |   18.19.0    |   0.12.13    |   0.11.11    |
|    21.2.0    |   18.18.2    |   0.12.12    |   0.11.10    |
|    21.1.0    |   18.18.1    |   0.12.11    |    0.11.9    |
|    21.0.0    |   18.18.0    |   0.12.10    |    0.11.8    |
|    20.8.1    |   18.17.1    |    0.12.9    |    0.11.7    |
|    20.8.0    |   18.17.0    |    0.12.8    |    0.11.6    |
|    20.7.0    |   18.16.1    |    0.12.7    |    0.11.5    |
|    20.6.1    |   18.16.0    |    0.12.6    |    0.11.4    |
|    20.6.0    |   18.15.0    |    0.12.5    |    0.11.3    |
|    20.5.1    |   18.14.2    |    0.12.4    |    0.11.2    |
|    20.5.0    |   18.14.1    |    0.12.3    |    0.11.1    |
|    20.4.0    |   18.14.0    |    0.12.2    |    0.11.0    |
|    20.3.1    |   18.13.0    |    0.12.1    |    0.9.12    |
|    20.3.0    |   18.12.1    |    0.12.0    |    0.9.11    |
|    20.2.0    |   18.12.0    |   0.10.48    |    0.9.10    |

可以看到LTS下的版本列表,我选择了18.19.1版本,执行如下命令进行安装

代码语言:javascript
复制
nvm install 18.19.1

然后就静静等待安装结束,直到看到控制台输出如下信息,表示安装已经完成

代码语言:javascript
复制
Downloading node.js version 18.19.1 (64-bit)...
Complete
Downloading npm version 10.2.4... Complete
Installing npm v10.2.4...

Installation complete. If you want to use this version, type

nvm use 18.19.1

安装完成后我们用如下命令查看一下

代码语言:javascript
复制
nvm ls

执行结果如下

代码语言:javascript
复制
18.19.1

然后我们执行nvm use 18.19.1就可以生效该版本

代码语言:javascript
复制
nvm use 18.19.1

接下来就可以愉快的编码了

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-02-20,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 问题描述
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档