docs: 更新文章内容
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: NPM、Yarn、Vue CLI 的常见问题以及解决方法
|
||||
title: "NPM、Yarn、Vue CLI 的常见问题以及解决方法"
|
||||
date: 2025-03-15T23:00:14Z
|
||||
lastmod: 2025-03-15T23:02:32Z
|
||||
tags: [NPM,Yarn,Vue CLI]
|
||||
@@ -30,27 +30,27 @@ npm config set ELECTRON_MIRROR https://registry.npmmirror.com/-/binary/electron/
|
||||
|
||||
#### Vue CLI,编译 Less / Sass / Scss 时提示 this.getOptions is not a function
|
||||
|
||||
`less-loader` 或 `sass-loader` 的版本过高,不兼容,需要降级。
|
||||
`less-loader` 或 `sass-loader` 的版本过高,不兼容,需要降级。
|
||||
|
||||
对于 Less:
|
||||
|
||||
1. 执行 `npm uninstall less-loader` 卸载已有版本。
|
||||
2. 执行 `npm install less-loader@5.0.0 -D` 安装低版本的 `less-loader`。
|
||||
2. 执行 `npm install less-loader@5.0.0 -D` 安装低版本的 `less-loader`。
|
||||
|
||||
对于 Sass / Scss:
|
||||
|
||||
1. 执行 `npm uninstall sass-loader` 卸载已有版本。
|
||||
2. 执行 `npm install sass-loader@8.0.2 -D` 安装低版本的 `sass-loader`。
|
||||
2. 执行 `npm install sass-loader@8.0.2 -D` 安装低版本的 `sass-loader`。
|
||||
|
||||
#### 使用 vue init 命令创建 electron-vue 模板项目时一直处于 downloading template 状态
|
||||
|
||||
使用 `vue init simulatedgreg/electron-vue` 命令创建 electron-vue 模板项目时一直处于 `downloading template` 状态。
|
||||
使用 `vue init simulatedgreg/electron-vue` 命令创建 electron-vue 模板项目时一直处于 `downloading template` 状态。
|
||||
|
||||
可能的原因:使用 `vue init` 创建项目时,默认从 GitHub 下载模板,而且还会把 `.vue-templates` 目录下已经下载过的 `simulatedgreg-electron-vue` 模板目录删除,隐藏在网络不好的情况下会一直 `downloading template`。
|
||||
可能的原因:使用 `vue init` 创建项目时,默认从 GitHub 下载模板,而且还会把 `.vue-templates` 目录下已经下载过的 `simulatedgreg-electron-vue` 模板目录删除,隐藏在网络不好的情况下会一直 `downloading template`。
|
||||
|
||||
解决办法:下载 [SimulatedGREG/electron-vue](https://github.com/SimulatedGREG/electron-vue/) 到本地,解压放入 `C:\Users\用户名\.vue-templates`,文件夹名称为 `simulatedgreg-electron-vue`。
|
||||
解决办法:下载 [SimulatedGREG/electron-vue](https://github.com/SimulatedGREG/electron-vue/) 到本地,解压放入 `C:\Users\用户名\.vue-templates`,文件夹名称为 `simulatedgreg-electron-vue`。
|
||||
|
||||
然后执行 `vue init simulatedgreg/electron-vue` 时增加一个参数 `--offline`,否则会重新下载:
|
||||
然后执行 `vue init simulatedgreg/electron-vue` 时增加一个参数 `--offline`,否则会重新下载:
|
||||
|
||||
```plaintext
|
||||
vue init simulatedgreg/electron-vue 项目名称 --offline
|
||||
|
Reference in New Issue
Block a user