Node.js 14.15.2 CentOS 8.2 64位
操作系统版本:CentOS 8.2 64位 Node.js版本:14.15.2
商品参数
商品介绍
1. 服务器账户信息:CentOS系统默认管理员账户为root,默认密码为新购云主机设置的密码,如需重置密码请登陆腾讯云管理控制台,如图所示,找到左侧菜单栏【云服务器CVM】';font-family:'等线>';font-family:'等线>';font-family:'等线>等线>
';font-family:等线;mso-bidi-font-family:'times>
提交之后重启实例即可。
';font-family:'等线>';font-family:'等线>2. 默认防火墙是关闭的
';font-family:'等线>';font-family:'等线>等线>【系统登录】';font-family:'等线>
';font-family:'等线>
本地个人电脑安装Xshell或者CRT SSH远程连接工具,';font-family:'等线>';font-family:'等线>';font-family:'等线>
';font-family:等线;mso-bidi-font-family:'times>
一、';font-family:'等线>npm';font-family:'等线>安装模块';font-family:'等线>
';font-family:'等线>
Npm 安装模块
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>npm install <Module Name> 安装模块到项目目录下
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>npm install <Module Name> -g安装模块到全局
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
例如:
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>二、构建项目';font-family:'等线>
';font-family:'等线>
';font-family:等线;mso-bidi-font-family:'times>
进入项目所在目录,执行cnpm install&&npm run build,生成的包会在dist文件夹下。
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>例如:';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
三、启动项目';font-family:'等线>
';font-family:'等线>
';font-family:等线;mso-bidi-font-family:'times>
1)package.json文件scripts的serve字段中配置了服务启动的命令。
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
例如:
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
"scripts": {
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>"serve": "vue-cli-service serve",
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>"build": "vue-cli-service build",
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>"lint": "vue-cli-service lint"
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>},
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
npm run serve
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>2)将dist生成的静态文件,放置应用中启动
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
3)通过pm2管理启动
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
四、npm命令';font-family:'等线>
';font-family:'等线>
';font-family:'等线>
npm init 初始化package.josn文件
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>npm uninstall <Module Name> 卸载模块
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>npm update <Module Name> 更新模块
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>npm outdated <Module Name> 检查模块是否过时
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>npm start 启动模块(该命令写在package.json文件scripts的start字段中,可以自定义命令来配置一个服务器环境和安装一系列的必要程序,如果没有配置,默认直接启动node server.js)
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>npm stop 停止模块
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>npm restart 重新启动模块
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>npm --version 查看npm版本
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>npm ls 查看当前目录下安装的模块
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>pm2 start app.js 启动app项目
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>pm2 list 列出由pm2管理的所有进程信息
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>pm2 logs 显示所有进程日志
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>pm2 stop all 停止所有进程
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>pm2 restart all 重启所有进程
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
五、package';font-family:'等线>.json';font-family:'等线>语法';font-family:'等线>
';font-family:'等线>
';font-family:等线;mso-bidi-font-family:'times>
n';font-family:等线;mso-bidi-font-family:'times>ame';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
在package.json中最重要的就是name和version字段。他们都是必须的,如果没有就无法install。name和version一起组成的标识在假设中是唯一的。改变包应该同时改变version。
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
name是这个东西的名字。注意:
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
不要把node或者js放在名字中。
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
version';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
version必须能被node-semver解析,它被包在npm的依赖中。(要自己用可以执行npm install semver)
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
description';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
放简介,字符串
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
keywords';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
关键字,数组、字符串
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
license';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
许可证。
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
repository';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
指定代码存放的地方。
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:'等线>
Scripts';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
“scripts”是一个由脚本命令组成的hash对象,他们在包不同的生命周期中被执行。key是生命周期事件,value是要运行的命令。
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
config';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
"config" hash可以用来配置用于包脚本中的跨版本参数。
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
dependencies';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
依赖是给一组包名指定版本范围的一个hash。
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
devDependencies';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
用于测试开发的dependencies
';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
';font-family:等线;mso-bidi-font-family:'times>
【声明】
';font-family:'等线>';font-family:'等线>1、镜像中如有收费软件,请根据软件官方说明购买使用版权,因版权问题产生的纠纷本公司概不负责。
';font-family:'等线>';font-family:'等线>2、镜像操作系统为公司定制,并经过反复测试验证,请参照商品详情中信息使用,免费镜像为客户体验使用,收费镜像为镜像制作费用,除镜像本身默认环境问题,均不含任何人工技术支持。
';font-family:'等线>';font-family:'等线>';font-family:'等线>3、部分付费镜像有安全加固,但不保证服务器绝对安全,互联网中不存在绝对安全的服务器,请做好代码安全,并培养良好的使用习惯。
';font-family:'等线>';font-family:'等线>';font-family:'等线>
【售后问题】
';font-family:'等线>';font-family:'等线>1、如有软件不能正常使用的情况请联系在线技术支持,技术支持请优先选择客服;
';font-family:'等线>';font-family:'等线>2、如需在线技术支持,配置、调试、故障排查、安全加固、安全测试、高并发测试、负载均衡、集群等等服务请参照本公司服务类产品说明联系技术咨询
';font-family:等线;mso-bidi-font-family:'times>';font-family:'等线>售后服务
为保障您的权益,请勿线下交易!90%的欺诈、纠纷、资金盗窃均由线下交易导致。腾讯云市场为您提供以下服务保障:
优质服务商家
严格准入 提供海量上云服务
7*8小时在线客服
全程在线咨询 助您安心购物
专业测试保证品质
安全监测 保障商品质量
售后无忧
不满意可退款 保障售后无忧