[vuejs/vue-cli]更新@vue/cli-service到3.8.3后,热重载网络显示不可用

2023-12-19 330 views
4
版本

3.8.3

环境信息
System:
    OS: Windows 10
    CPU: (4) x64 Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz
  Binaries:
    Node: 11.3.0 - D:\devtools\dev_nvm\nodejs\node.EXE
    Yarn: 1.16.0 - D:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.4.1 - D:\devtools\dev_nvm\nodejs\npm.CMD
  Browsers:
    Edge: 44.17763.1.0
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0 
    @vue/babel-plugin-transform-vue-jsx:  1.0.0 
    @vue/babel-preset-app:  3.8.0 
    @vue/babel-preset-jsx:  1.0.0 
    @vue/babel-sugar-functional-vue:  1.0.0 
    @vue/babel-sugar-inject-h:  1.0.0 
    @vue/babel-sugar-v-model:  1.0.0 
    @vue/babel-sugar-v-on:  1.0.0 
    @vue/cli-overlay:  3.8.0 
    @vue/cli-plugin-babel: ^3.8.0 => 3.8.0 
    @vue/cli-service: ^3.8.3 => 3.8.3 
    @vue/cli-shared-utils:  3.8.0 
    @vue/component-compiler-utils:  2.6.0 
    @vue/preload-webpack-plugin:  1.1.0 
    @vue/web-component-wrapper:  1.2.0 
    vue: ^2.6.10 => 2.6.10 
    vue-cli-plugin-ljx-test: ^1.0.71 => 1.0.71 
    vue-cli-plugin-style-resources-loader: ^0.1.3 => 0.1.3 
    vue-hot-reload-api:  2.3.3 
    vue-infinite-scroll: ^2.0.2 => 2.0.2 
    vue-lazyload:  1.2.3 
    vue-loader:  15.7.0 
    vue-router: ^3.0.6 => 3.0.6 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.6.10 => 2.6.10 
    vue-template-es2015-compiler:  1.9.1 
  npmGlobalPackages:
    @vue/cli: Not Found
重现步骤
  1. npm 更新
  2. npm 运行服务
预期是什么?

网络:http://localhost:8080

到底发生了什么?

网络:不可用


但通过ip还是能显示访问得到的,只是终端没出来。。

图像

回答

0

default-gateway 包似乎无法解析 unicode 接口名称。你可以在#3266 中看到详细信息。

在错误修复之前,您可以尝试将适配器名称重命名为英文。

@吕嘉轩

4

你好@zrh122,当我的项目最终安装依赖的时候,报告如下错误:

yarn install v1.10.1
info No lockfile found.
[1/4] 🔍  Resolving packages...
warning @vue/cli-plugin-eslint > eslint > file-entry-cache > flat-cache > circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
warning webpack-bundle-analyzer > bfj-node4@5.3.1: Switch to the `bfj` package for fixes and new features!
[2/4] 🚚  Fetching packages...
error execa@2.0.4: The engine "node" is incompatible with this module. Expected version "^8.12.0 || >=9.7.0". Got "8.11.2"
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

环境:

  • 节点:8.11.2
  • npm:5.6.0
  • 操作系统:达尔文

经排查:发现是一个依赖包版本问题

项目依赖@vue/cli-service: "^3.8.0"

依赖关系: cli-服务>默认网关>埃克卡

问题:

默认网关@5.0.2 >执行@^1.0.0 默认网关@5.0.3 >执行@^2.0.3 而 execa@^1.0.0: 引擎 - 节点 >= 6 execa@^2.0.3: 引擎 - 节点 ^8.12.0 || >=9.7.0

问题原因:

6

@dmccer execa@^2.0.3依赖新版本的node,你升级node的版本应该就可以了

5

@zrh122 本地升级了,资源不能随意升级!! 是否可以固定版本? default-gateway@5.0.2 开发者如果节点 < 8.12.0,都将最终安装无法依赖 目前我将 cli-service 的版本固定在 3.8.3 ,解决了这个问题,但这不是一个解决的办法。

6

@sodatea 最新的 default-gateway 导致依赖最低的节点提升到8.12.0,而目前 cli-service 是要求 >=8.

4
yarn install --ignore-engines

https://yarnpkg.com/lang/en/docs/cli/install/#toc-yarn-install-ignore-engines

这是yarn 和 npm 实现的不一致引起的。npm 的文档里写了:

除非用户设置了 engine-strict 配置标志,否则此字段仅供参考,并且仅在您的软件包作为依赖项安装时才会产生警告。

execa 并没有使用什么必须 Node.js 8.12+ 才能使用的功能,它的代码和 8.11.2 应该是兼容的,所以绕过这个安装报错就行了。

6

请问最后怎么解决的?网上找不到解决方法