[Node:安装]:初始化Vue项目

安装node客户端

在这里插入图片描述

查看版本 node -v

C:\Users\30252>node -v
v20.13.1

安装vue-cli

C:\Users\30252>npm install -g @vue/cli
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.

查看vue版本

C:\Users\30252>vue --version
@vue/cli 5.0.8

初始化项目: vue create instruction-sys

PS E:\WorkContent\shanghaikaifangdaxue\shujukuyingyong\testFour> vue create instruction-sys
vue : 无法加载文件 C:\Users\30252\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/
go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1

第一种:解决异常:通过idea类似工具执行命令

PS E:\WorkContent\shanghaikaifangdaxue\shujukuyingyong\testFour> vue create instruction-sys
? Your connection to the default npm registry seems to be slow.
Use https://registry.npmmirror.com for faster installation? Yes
Vue CLI v5.0.8
? Please pick a preset: Default ([Vue 3] babel, eslint)
Vue CLI v5.0.8
✨ Creating project in E:\WorkContent\shanghaikaifangdaxue\shujukuyingyong\testFour\instruction-sys.
🗃 Initializing git repository…
⚙️ Installing CLI plugins. This might take a while…
added 872 packages in 29s
100 packages are looking for funding
run npm fund for details
🚀 Invoking generators…
📦 Installing additional dependencies…
added 89 packages in 4s
112 packages are looking for funding
run npm fund for details
⚓ Running completion hooks…
📄 Generating README.md…
🎉 Successfully created project instruction-sys.
👉 Get started with the following commands:
$ cd instruction-sys
$ npm run serve
在这里插入图片描述

第二种:解决异常:通过设置策略 为RemoteSigned

po
wershell 查看执行策略
get-ExecutionPolicy
PS E:\WorkContent\shanghaikaifangdaxue\shujukuyingyong\testFour> get-ExecutionPolicy
Restricted

Set-ExecutionPolicy 是一个 PowerShell 命令,用于更改 PowerShell 的执行策略,以控制哪些脚本可以在系统上运行。RemoteSigned 是其中一种执行策略选项。

执行策略有四种:

Restricted:默认设置,不允许任何脚本运行。

AllSigned:只能运行由可信任发布者签名的脚本。

RemoteSigned:运行由本地管理员签名的脚本,以及从远程获取的由可信发布者签名的脚本。

Unrestricted:允许所有脚本运行。

解决方案:

如果你想要更改执行策略为 RemoteSigned,你需要以管理员身份运行 PowerShell,然后输入以下命令:

Set-ExecutionPolicy RemoteSigned

运行Vue项目:npm run serve

切换终端到vue项目下执行:npm run serve

在这里插入图片描述

PS E:\WorkContent\shanghaikaifangdaxue\shujukuyingyong\testFour\instruction-sys> npm run serve

> instruction-sys@0.1.0 serve
> vue-cli-service serve

 INFO  Starting development server...


 DONE  Compiled successfully in 4596ms                                                                                                                                      08:32:28


  App running at:
  - Local:   http://localhost:8080/
  - Network: http://192.168.1.4:8080/

  Note that the development build is not optimized.
  To create a production build, run npm run build.
  • 12
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值