Comments (1)
@wojiaoerdandan 这个问题很有价值。
常规部署应用的做法:
- 生产机拉代码
git pull
- 安装依赖
yarn install
- 构建
yarn build
- 运行
yarn start
但由于我实际环境的生产机的性能不足以跑 “构建” 这一步(会死机),所以 “构建” 这一步被我转移到 GitHub Actions 进行:
GitHub Actions 在收到 push tags
/ release
事件后:
生产机 deploy.sh
脚本做的事情:
- 拉取最新代码
git pull
- 安装依赖
yarn install
(这一部很重要,也就是你困惑的问题) - 将
release
分支的(构建后)代码拉取到本地的dist
文件夹 - 运行程序
yarn start
可以看出:
- 我分解出的一个重要步骤是
yarn build
这一步,build
是对机器有性能要求的一步 - Node.js 应用在任何地方运行都需要保证
node_modules
是存在且有效的,所以我在生产机那里,只需要做yarn install --frozen-lockfile --production
即可
from nodepress.
Related Issues (20)
- 遇到一个ts编译问题,排查了好久,记录一下,给后来者遇到的人 HOT 1
- jwt续签问题 HOT 2
- 关于[数据流异常拦截器]的疑问
- mac 下clone词项目安装依赖各种报错 HOT 4
- 三个博客项目怎么跑起来? HOT 3
- windows linux都跑步起来啊 HOT 6
- yarn run start:prod HOT 1
- 加swagger 编译报错
- 如何实现拦截器依赖注入? HOT 4
- Linux下npm run start:prod编译报错 HOT 1
- 請問有沒有方法可以seed data?
- Node Gyp 问题 HOT 1
- 全局异常过滤器报错
- you mis-spelled it wrong, please fix it HOT 2
- yarn start:prod出现以下报错 HOT 1
- 找不到rss.xml HOT 1
- 可以考虑加入 swagger HOT 2
- Linux 服务器部署问题 HOT 4
- 本地dev编译问题 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodepress.