当前位置:网站首页>npm和package.json
npm和package.json
2022-08-02 03:22:00 【cjx177187】
npm:
提供项目中模块/插件的 下载相关功能
在生成的package.json文件中去下载
下载(常用)
npm i/install 模块名字/模块名字@版本号
举例:
npm i [email protected]
npm i 模块名 ====>安装到本地
npm i 模块名 -g=====>安装到全局
npm i 模块名 --save=====>安装到项目依赖
运行:
npm run 指令名=====>运行文件
指令名是package.json文件中script中我们自定义文件的运行属性名
更新/删除
npm update 模块名 ====>帮你更新到最新版本
npm update 模块名@版本 ====>帮你更新到指定版本
npm uninstall 模块名 =====>删除模块
package.json 文件:
每一个项目 构建时 先构建一个package.json文件它代表了这个项目的一些结构和配置信息(项目的清单),在进行项目迁移时只需要这份文件和自己的源代码就可以了。
构建指令:
在项目文件夹下
npm init===>创建json文件,会依次询问你项目名,版本号,主文件等各种各样的信息。
npm init -y====>自动初始化一个项目清单文件,不用再一次去填写,全部默认化
注意:生成package.json文件时其文件名必须是英文,文件夹名是中文使用npm int-y会报错
npm i =====>是按照项目清单文件去安装所有的依赖项,会在项目文件夹中生成一个node_modules文件夹,里面就是我们所需要的依赖包;在package.json文件中添加一个dependencies属性,里面添加我们所需要的一些依赖模块,包括版本号。
当然package.json中的模块也会依赖于一些模块,这些模块就在package_lock.json文件中。这个文件没有什么实质的用,可以没有。
自定义模块
import 是es6的语法 ==>导出 export defualt xxx
require是node能读懂的语法==>导出 moudel.exports={}
边栏推荐
- 3 minutes to take you to understand WeChat applet development
- oracle内连接和外连接
- 动态代理工具类
- Chemical reagent Phospholipid-polyethylene glycol-hydroxyl, DSPE-PEG-OH, DSPE-PEG-Hydroxyl, MW: 5000
- 配置mmdet来训练Swin-Transformer之一配置环境
- MySQL两阶段提交串讲
- @ApiModel 和 @ApiModelProperty
- require模块化语法
- IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boo
- 2022年比若依更香的开源项目
猜你喜欢
The @autowired distinguished from @ the Resource
[Basic Tutorial of Remote Control Development 1] Crazy Shell Open Source Formation Drone-GPIO (Remote Control Indicator Light Control)
UserWarning:火炬。meshgrid:在以后的版本中,它将被要求通过索引ing argu
How to check whether a table is locked in mysql
@Configuration详解
oracle inner join and outer join
kettle 安装与配置
Phospholipid-polyethylene glycol-hydrazide, DSPE-PEG-Hydrazide, DSPE-PEG-HZ, MW: 5000
Redis简单学习笔记
化学试剂磷脂-聚乙二醇-羟基,DSPE-PEG-OH,DSPE-PEG-Hydroxyl,MW:5000
随机推荐
sh: 1: curl: not found
MySQL分组后排序
Deveco studio Hongmeng app access network detailed process (js)
磷脂-聚乙二醇-靶向新生血管靶向肽APRPG,DSPE-PEG-APRPG
getattr() function analysis
DSPE-PEG-PDP, DSPE-PEG-OPSS, phospholipid-polyethylene glycol-mercaptopyridine supply, MW: 5000
AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
subprocess.CalledProcessError: Command 'pip install 'thop'' returned non-zero exit status 1.
@Autowired注解的使用
DSPE-PEG-Silane, DSPE-PEG-SIL, phospholipid-polyethylene glycol-silane modified active group
分布式领域最重要的一篇论文,到底讲了什么?
Error: with open(txt_path,'r') as f: FileNotFoundError: [Errno 2] No such file or directory:
Basic usage of Monaco Editor
MySQL两阶段提交串讲
Problems when yolov5 calls ip camera
C语言 内联函数
Phospholipid-polyethylene glycol-azide, DSPE-PEG-Azide, DSPE-PEG-N3, MW: 5000
【手把手带你学nRF52832/nRF52840 · (1)开发环境搭建】
UserWarning:火炬。meshgrid:在以后的版本中,它将被要求通过索引ing argu
MySQL8.0安装教程,在Linux环境安装MySQL8.0教程,最新教程 超详细