> dev> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
使用npm run dev
产生了错误。
目前存在这种情况,可能是三个原因造成的
1.webpack版本与vue版本不一致
2.本地运行IP地址不正确
3.本地运行localhost与127.0.0.1映射被修改
1.webpack版本与vue版本不一致
1.查看vue版本
vue -V
4.5.15
2.卸载、安装对应版本webpack
我的vue是4.5.15但是没有对应的dev-server的版本,我就下载了个4.3.1的,看了个文章这个版本应该比较适配,如果是其他的版本,你们可以找找有没有相同版本
npm uninstall webpack-dev-server
npm install webpack-dev-server@4.3.1
没注意有个警告,我接着直接
npm install
npm run dev
根据提示,运行了下npm audit
大概可能是版本问题以及的不同的适配问题可能节点伪造的加密签名的密匙不当?
我就把之前安装的那个dev-server先给卸载。卸载命令
npm uninstall webpack-dev-server
删除src里头的node-modules
和package.lock.json.
重新再次npm install
接着npm run dev
emmm就大概是又重新归档原点了。?
考虑到网络之类的问题,把自己的项目重新git了一遍 ,运行npm install
出现了新的错误。。。。
接着出现了更多错误,
npm run dev
> vue-element-admin@4.3.1 dev
> vue-cli-service serve
INFO Starting development server...
10% building 2/4 modules 2 active ...33.145.154:9876&sockPath=/sockjs-nodeE
rror: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (D:\java\SPACE\ggit-space\framework\vue-element-admin
\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\java\SPACE\ggit-space\framework\vue-
element-admin\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (D:\java\SPACE\ggit-space\framework\vue-element-adm
in\node_modules\webpack\lib\NormalModule.js:471:10)
at D:\java\SPACE\ggit-space\framework\vue-element-admin\node_modules\we
bpack\lib\NormalModule.js:503:5
at D:\java\SPACE\ggit-space\framework\vue-element-admin\node_modules\we
bpack\lib\NormalModule.js:358:12
rk\vue-element-ad
min\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (D:\java\SPACE\ggit-space\framework\vue-element-adm
in\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at D:\java\SPACE\ggit-space\framework\vue-element-admin\node_modules\en
hanced-resolve\lib\CachedInputFileSystem.js:91:9
at D:\java\SPACE\ggit-space\framework\vue-element-admin\node_modules\gr
aceful-fs\graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/r
ead_file_context:68:3) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initializ
ation error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v17.3.0
npm ERR! code 1
npm ERR! path D:\java\SPACE\ggit-space\framework\vue-element-admin
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c "vue-cli-service serv
e"
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\devil\AppData\Local\npm-cache\_logs\2022-05-12T13_22_
55_255Z-debug.log
D:\java\SPACE\ggit-space\framework\vue-element-admin>export NODE_OPTIONS=--
openssl-legacy-provider
'export' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
D:\java\SPACE\ggit-space\framework\vue-element-admin>
> vue-element-admin@4.3.1 dev
> vue-cli-service serve
ERROR Error: .presets[0] must be a string, object, function
Error: .presets[0] must be a string, object, function
at assertPluginTarget (D:\java\SPACE\ggit-space\framework001\vue-element-admin\node_modules\@babel\core\lib\config\validation\option-assertions.js:2
78:11)
at assertPluginItem (D:\java\SPACE\ggit-space\framework001\vue-element-admin\node_modules\@babel\core\lib\config\validation\option-assertions.js:270
:5)
at D:\java\SPACE\ggit-space\framework001\vue-element-admin\node_modules\@babel\core\lib\config\validation\option-assertions.js:236:30
at Array.forEach (<anonymous>)
at assertPluginList (D:\java\SPACE\ggit-space\framework001\vue-element-admin\node_modules\@babel\core\lib\config\validation\option-assertions.js:236
:9)
at D:\java\SPACE\ggit-space\framework001\vue-element-admin\node_modules\@babel\core\lib\config\validation\options.js:118:5
at Array.forEach (<anonymous>)
at validateNested (D:\java\SPACE\ggit-space\framework001\vue-element-admin\node_modules\@babel\core\lib\config\validation\options.js:94:21)
at validate (D:\java\SPACE\ggit-space\framework001\vue-element-admin\node_modules\@babel\core\lib\config\validation\options.js:85:10)
at D:\java\SPACE\ggit-space\framework001\vue-element-admin\node_modules\@babel\core\lib\config\config-chain.js:204:34
npm ERR! code 1
npm ERR! path D:\java\SPACE\ggit-space\framework001\vue-element-admin
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c "vue-cli-service serve"
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\devil\AppData\Local\npm-cache\_logs\2022-05-13T05_57_52_484Z-debug.log
D:\java\SPACE\ggit-space\framework001\vue-element-admin>
D:\java\SPACE\ggit-space\framework001\vue-element-admin>npm audit fix --force
npm WARN using --force Recommended protections disabled.
npm WARN audit No fix available for tui-editor@*
npm WARN audit Updating @vue/cli-service to 5.0.4,which is a SemVer major change.
npm W
我之前启动我们项目的时候 没一点事,不知道为什么出了事情。后端没问题是前端的问题。
一开始我的node版本是16.10.0的版本,因为有的包不支持,后来换成了17.3.0版本,没想到还是出错了,接着换成了14.5.0。再次启动项目,执行了一次npm install,之后每次启动项目都只有npm run dev。就启动成功了,有的时候可能是网络问题。所以才导致那么多错误,大概是这个原因,其他的的原因找到了我再继续写吧。