惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MongoDB | Blog
MongoDB | Blog
Recorded Future
Recorded Future
Jina AI
Jina AI
The Register - Security
The Register - Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
F
Fortinet All Blogs
人人都是产品经理
人人都是产品经理
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
The GitHub Blog
The GitHub Blog
Vercel News
Vercel News
博客园 - 【当耐特】
雷峰网
雷峰网
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
Security Latest
Security Latest
有赞技术团队
有赞技术团队
L
Lohrmann on Cybersecurity
P
Proofpoint News Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
P
Privacy & Cybersecurity Law Blog
Scott Helme
Scott Helme
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
Hacker News - Newest:
Hacker News - Newest: "LLM"
NISL@THU
NISL@THU
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
B
Blog RSS Feed
Cyberwarzone
Cyberwarzone
K
Kaspersky official blog
F
Full Disclosure
Martin Fowler
Martin Fowler
Spread Privacy
Spread Privacy
D
Docker
C
Cisco Blogs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page

Claude's Blog

浅谈 npm 依赖治理 记录 Got(Node.js) 代理 HTTP 请求的坑 如何管理桌面窗口 SSR 页面 CDN 缓存实践 从 is-promise 事件我们可以学到什么 分享一个 npm dist-tag 的冷知识 从 Vimium 到 qutebrowser Verdaccio 性能优化:单机 Cluster 让 npm install 不使用缓存的方法 Verdaccio 性能优化:代理分流 Verdaccio 性能优化:上游路径转发 CSAPP DataLab 题解 不靠谱的 Egg.js 框架开发指南 如何解决 Debian 系 Elastic apm-server 7.x 启动失败 Hexo NexT 主题升级 7.4 From Journeyman to Master Mac 上移除 EasyConnect 常驻后台进程 Nginx SWRR 算法解读 记一次 Node.js 进程挂起的 BUG 追踪
警惕 Travis CI 的 npm 缓存
Post author: Claude Ray · 2019-08-01 · via Claude's Blog

从 2019 年 7 月份开始,Travis CI 默认开启 npm 缓存。这意味着 node_module 和 package-lock.json 会在初次构建时缓存,倘若后续更新 npm 依赖而不刷新该缓存,可能带来构建失败的问题。

下面是发现问题的源头。

在为一个项目添加了新的依赖 rimraf 之后,Travis CI 意外地报错:

1
sh: 1: rimraf: not found

此时 .travis.yml 配置为

1
2
3
4
5
6
7
8
9
10
11
12
13
sudo: false
language: node_js
node_js:
- '8'
- '10'
before_install:
- npm i npminstall -g
install:
- npminstall
script:
- npm run ci
after_script:
- npminstall codecov && codecov

很明显新增的 npm 依赖没有安装上,但本地测试没有问题,于是替换 npminstall 为原生的 npm install,降低问题排查范围。

1
2
3
4
5
6
7
8
9
sudo: false
language: node_js
node_js:
- '8'
- '10'
script:
- npm run ci
after_script:
- npm install codecov && codecov

然而移除 npminstall 之后,报错变为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Unhandled rejection RangeError: Maximum call stack size exceeded
at RegExp.test (<anonymous>)
at /home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/node_modules/aproba/index.js:38:16
at Array.forEach (<anonymous>)
at module.exports (/home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/node_modules/aproba/index.js:33:11)
at flatNameFromTree (/home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/lib/install/flatten-tree.js:37:3)
at flatNameFromTree (/home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/home/travis/.nvm/versions/node/v8.16.0/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)

之后,去掉 rimraf 依赖于事无济,重跑其他 node 项目的 ci 却一切正常,因此最终确定是 travis 运行环境带来的问题。

果然,寻找刷新方法的过程中发现了右侧 More options 中的 Caches 选项,点击里面的删除键后,CI 重新运行成功。

Reference

https://docs.travis-ci.com/user/caching/#npm-cache

Please note that as of July 2019, npm is cached by default on Travis CI

To disable npm caching, use:

1
2
cache:
npm: false