首页 > 编程语言 >nodejs package.json

nodejs package.json

时间:2023-06-08 15:36:51浏览次数:47  
标签:npm run nodejs app package js start json test

package.json是用来识别项目并且处理项目的依赖关系的

{
    "name": "名",//包名字
    "version": "1.0.0", //版本
    "description": "描述",
    "main": "index.js",//入口文件
    "scripts": {//指定运行脚本命令的 npm 命令行缩写
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "keywords": [], //关键词
    "author": "", //作者
    "license": "ISC",//许可证,默认是ISC、有的默认是MIT
    "dependencies": { //指定了项目运行所依赖的模块
        "jsdom": "^15.1.1",
        ……
    },
    "devDependencies": { //指定了项目开发所需要的模块
        "nodemon": "^1.19.1",
        ……
    }
}

里面的scripts字段,可以用于定义脚本命令,供npm直接调用,用npm run xx 运行

如:

{
    ……
    "scripts": {
        "start": "node app.js",
        "dev": "./node_modules/.bin/nodemon app.js",
        "prd": "pm2 start app.js",
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    ……
}

运行 npm run start   相当于  node app.js

运行 npm run dev    相当于  nodemon app.js

运行 npm run  prd    相当于  pm2 start app.js

标签:npm,run,nodejs,app,package,js,start,json,test
From: https://www.cnblogs.com/baby123/p/17466612.html

相关文章

  • ExcelPackage操作Excel的常用方法
    游戏开发中最常用的工具应该当属Excel了,而Excel在数据量比较大,或者多张表进行关联的时候操作比较繁琐,偶尔会有一些工具需要,减化上述的一些操作,提升工作效率。最开始想使用Node.js,发现二个问题,Github上第三方库,在保存Excel的时候会将格式给丢掉。找来找来,发现C#的Epplus比较......
  • go json、yaml解码
    func GetFoo(ctx context.Context) (*T, error) {  req, err := http.NewRequest("GET", "http://foo/t.json", nil)  if err != nil {    return nil, err  }  req = req.WithContext(ctx)  res, err := http.DefaultClient.Do(req)  if e......
  • Nutika 打包 docx 库 出现 docx.opc.exceptions.PackageNotFoundError: Package not f
    docx.opc.exceptions.PackageNotFoundError:Packagenotfoundat重现用以下命令打包exe:nuitka--standalone--show-memory--show-progress--nofollow-imports--enable-plugin=pyqt5--follow-import-to=utils,src--output-dir=out--windows-icon-from-ico=./termius_1.......
  • 13_How to Deploy NodeJs app on Ubuntu in Production
     地址:https://www.codewithharry.com/blogpost/deploy-nodejs-app-on-ubuntu/ HowtodeployaNode.jsapplicationinproductionInthispost,wewillseehowtorunanddeployNodeJSappsinproduction.Followthestepsbelow:Step1-InstallNodejsLet�......
  • 什么是json
    a='{"pwd":"12345678","type":1}'#判断是不是一个json,可以在网上找json工具进行判断#b不是jsonb="{'pwd':'12345678','type':1}"#json表示数据为空是null,不是Nonec='{"mobile_phone":null,"pw......
  • 格式化显示JSON数据
     测试JSON{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":2,"relation":"eq......
  • 复杂json串解析
    1、有如下Json串需要解析成本地对象(实为京东开普勒业绩订单请求返回的json串):String串:result:{"jd_kpl_open_unionservice_queryCommisions_response":{"message":"SUCCESS","totalNum":null,"result":[{"plus":0,"orderDate":15324......
  • 在ubuntu上后台启动nodejs、使用pm2启动多个nodejs,
    前言很久以前淘到了一个非常简易的nodejs(聊天室)的源码,今天想把他放到我的ubuntu(server20.10)上。一、正文如果直接使用指令nodeapp.js,退出终端的时候会报错,可以使用pm2来实现后台运行!1.安装node.js和npmapt-getinstallnodejsapt-getinstallnpm安装好了之后可以使用whereisn......
  • json
    //查询时间偏移select*fromcoinerwherecreated_at+interval'8hour'>'2023-01-1300:00:00'//jsonb查询attribute.Award.type='ttc'attribute->'Award'->>'type'='ttc//时间偏移去重分组sel......
  • 四、用JSON作前后端分离的交互
    在SpringReactiveSecurity中,Security过滤器是通过类ServerHttpSecurity配置的,用户认证过滤器是AuthenticationWebFilter,相当于SpringSecurity中的UsernamePasswordAuthenticationFilter。 在AuthenticationWebFilter中,用户名和密码的解析是通过ServerAuthenticationConverte......