Vue-cli: 更新@vue/cli-service到3.8.3后,热重载network显示unavailable

Created on 14 Jun 2019  ·  7Comments  ·  Source: vuejs/vue-cli

Version

3.8.3

Environment info

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

Steps to reproduce

  1. npm update
  2. npm run serve

What is expected?

Network: http://localhost:8080

What is actually happening?

Network: unavailable


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

image

bug

Most helpful comment

yarn install --ignore-engines

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

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

Unless the user has set the engine-strict config flag, this field is advisory only and will only produce warnings when your package is installed as a dependency.

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

All 7 comments

The package default-gateway seems failed to parse the unicode interface names. You may see the detail in #3266.

Before the bug fixed, you may try to rename the adaptor name in English.

@lvjiaxuan

你好 @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 > [email protected]: CircularJSON is in maintenance only, flatted is its successor.
warning webpack-bundle-analyzer > [email protected]: Switch to the `bfj` package for fixes and new features!
[2/4] 🚚  Fetching packages...
error [email protected]: 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.

环境:

  • node: 8.11.2
  • npm: 5.6.0
  • os: Darwin

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

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

依赖关系:
cli-service > default-gateway > execa

问题:

[email protected] > execa@^1.0.0
[email protected] > execa@^2.0.3

execa@^1.0.0: engines - node >= 6
execa@^2.0.3: engines - node ^8.12.0 || >=9.7.0

问题原因:
default-gateway 语义版本控制存在问题

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

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

@zrh122 本地升级了,打包服务器不能随意升级!!
是否可以固定版本? [email protected]
开发者如果 node < 8.12.0,都将初始安装不了依赖
目前我将 cli-service 的版本固定在 3.8.3 ,解决了这个问题,但这不是个恰当的办法。

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

yarn install --ignore-engines

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

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

Unless the user has set the engine-strict config flag, this field is advisory only and will only produce warnings when your package is installed as a dependency.

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

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

Was this page helpful?
0 / 5 - 0 ratings