前端基础系列(一)npm安装卸载及使用

零 修订记录

序号修订内容修订时间
1新增20210721

一 摘要

本文主要介绍npm 安装卸载及使用

二 环境信息

(一)操作系统

win10 64位

三 实施

(一) npm 相关

3.1.1 npm 卸载

  1. 从计算机应用程序里卸载 node.js
  2. 重启电脑
  3. 手工删除以下类似文件夹
    C:\Program Files (x86)\Nodejs(根据你自己的安装目录)
    C:\Program Files\Nodejs(根据你自己的安装目录)
    C:\Users{User}\AppData\Roaming\npm(或%appdata%\npm)
    C:\Users{User}\AppData\Roaming\npm-cache(或%appdata%\npm-cache)
  4. 检查您的%PATH%环境变量以确保没有引用Nodejs或npm存在
  5. 若还没有卸载干净 请where node在命令提示符下键入,您将看到它所在的位置 – 删除(也可能是父目录)
  6. 再次重启电脑

3.1.2 安装vue

3.1.2.1 首先要安装node

node 安装好之后,做如下检查

C:\Windows\system32>npm -v
6.14.13

C:\Windows\system32>node -v
v14.17.3
3.1.2.2 使用国内源
C:\Windows\system32>npm config get registry
https://registry.npmjs.org/

C:\Windows\system32>npm config set registry https://registry.npm.taobao.org

C:\Windows\system32>npm config get registry
https://registry.npm.taobao.org/
3.1.2.3 安装vue-cli
C:\Windows\system32>npm install -g vue-cli


C:\Windows\system32>vue -V
2.9.6

C:\Windows\system32>

3.1.2.4 安装webpack

3.1.2.5 安装bower

C:\Windows\system32>npm install -g bower

C:\Windows\system32>bower -v
1.8.12

C:\Windows\system32>

3.1.2.6 安装vue

我安装到 D:\front 目录下
安装命令 npm install vue --save

D:\front>npm install vue --save
npm WARN saveError ENOENT: no such file or directory, open 'D:\front\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'D:\front\package.json'
npm WARN front No description
npm WARN front No repository field.
npm WARN front No README data
npm WARN front No license field.

+ vue@2.6.14
added 1 package from 1 contributor in 0.486s
 D:\front 的目录

2021/07/22  11:34    <DIR>          .
2021/07/22  11:34    <DIR>          ..
2021/07/22  11:34    <DIR>          node_modules
2021/07/22  11:34               364 package-lock.json
               1 个文件            364 字节
               3 个目录 65,940,938,752 可用字节

D:\front>

3.1.2.7 安装bootstrap

d:\front>npm install bootstrap
npm WARN saveError ENOENT: no such file or directory, open 'd:\front\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'd:\front\package.json'

d:\front>cd node_modules

d:\front\node_modules>dir
 驱动器 D 中的卷没有标签。
 卷的序列号是 65F3-3762

 d:\front\node_modules 的目录

2021/07/23  11:12    <DIR>          .
2021/07/23  11:12    <DIR>          ..
2021/07/23  11:12    <DIR>          bootstrap
2021/07/22  11:34    <DIR>          vue
               0 个文件              0 字节
               4 个目录 65,932,136,448 可用字节

d:\front\node_modules>

3.1.2.8 安装指定版本jquery

d:\front>npm install jquery@1.11.1
npm WARN saveError ENOENT: no such file or directory, open 'd:\front\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'd:\front\package.json'
npm WARN bootstrap@5.0.2 requires a peer of @popperjs/core@^2.9.2 but none is installed. You must install peer dependencies yourself.
npm WARN front No description
npm WARN front No repository field.
npm WARN front No README data
npm WARN front No license field.

+ jquery@1.11.1
added 1 package from 1 contributor in 2.305s

1 package is looking for funding
  run `npm fund` for details

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值