gpt4 book ai didi

javascript - 在 Travis ci 中找不到全局安装的 npm 包

转载 作者:行者123 更新时间:2023-11-30 11:15:57 24 4
gpt4 key购买 nike

.travis.yml 文件是:

language: node_js
node_js:
- node
env:
global:
- secure: "[redacted]"
before_install:
- node ./bin/version_check.js
install:
- npm i
- npm i -g codecov
- npm i -g @octokit/rest
script:
- npm run lint
- npm run build
- npm run ci
deploy:
- skip_cleanup: true
provider: npm
email: obfishstudio@gmail.com
api_key:
secure: "[redacted]"
on:
repo: jjyyxx/JSONSchemaSimulator
branch: master
- skip_cleanup: true
provider: script
script: node ./bin/auto_release.js
on:
repo: jjyyxx/JSONSchemaSimulator
branch: master

在安装阶段,@octokit/rest 包被安装。但是在第二个部署任务中,当我在 ./bin/auto_release.js 的第一行需要它时:

const Octokit = require('@octokit/rest')

Travis CI 显示Error: Cannot find module '@octokit/rest'

该项目可在 https://github.com/jjyyxx/JSONSchemaSimulator 获得.

ci 报告可在 https://travis-ci.org/jjyyxx/JSONSchemaSimulator/builds/408414549 获得.

最佳答案

所以我之前没有使用过 Travis CI,但我使用的是 GitLab CI,实际上遇到了同样的情况。

问题是,全局包不会合并到作业的缓存中,因此会在安装 完成后删除。

对于这种设置,我强烈建议在本地而不是全局安装包。

其中一个原因是执行程序可能用于不同的构建作业,如果全局安装不同的包版本并相互干扰,那将是非常不幸的。

关于javascript - 在 Travis ci 中找不到全局安装的 npm 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51535658/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com