gpt4 book ai didi

docker - 错误 : Missing binding "binding.node" after merge to main branch

转载 作者:行者123 更新时间:2023-12-01 21:58:52 25 4
gpt4 key购买 nike

我尝试在 GitLab 的一个分支中配置 CI/CD 中的自动代码覆盖,并且管道在分支内完美通过,但是当管理员将更改合并到主分支时,管道由于缺少绑定(bind)。

我使用 gitlab-ci.yml 配置我的作业。我没有任何使用管道的经验,所以这对我来说几乎是一个反复试验的任务。

最后,我得到了适合我的配置,它没有破坏任何东西,并按要求生成了覆盖范围。但是,由于在成功构建之前显示无空间错误,我不得不强制清除缓存以使作业正常运行。在我的分支中,管道没有任何错误地通过了,我通过重新运行它多次进行了双重检查。但是一旦管理员合并了分支,它突然开始产生以下错误:

ERROR in Module build failed: Error: Missing binding /builds/internal/employee_portal/node_modules/node-sass/vendor/linux-x64-64/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x

Found bindings for the following environments:
- Linux 64-bit with Node.js 11.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
at module.exports (/builds/internal/employee_portal/node_modules/node-sass/lib/binding.js:15:13)
at Object.<anonymous> (/builds/internal/employee_portal/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.sassLoader (/builds/internal/employee_portal/node_modules/sass-loader/lib/loader.js:46:72)
ERROR in ./src/styles.scss
Module build failed: ModuleBuildError: Module build failed: Error: Missing binding /builds/internal/employee_portal/node_modules/node-sass/vendor/linux-x64-64/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x

Found bindings for the following environments:
- Linux 64-bit with Node.js 11.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
at module.exports (/builds/internal/employee_portal/node_modules/node-sass/lib/binding.js:15:13)
at Object.<anonymous> (/builds/internal/employee_portal/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.sassLoader (/builds/internal/employee_portal/node_modules/sass-loader/lib/loader.js:46:72)
at runLoaders (/builds/internal/employee_portal/node_modules/webpack/lib/NormalModule.js:244:20)
at /builds/internal/employee_portal/node_modules/loader-runner/lib/LoaderRunner.js:364:11
at /builds/internal/employee_portal/node_modules/loader-runner/lib/LoaderRunner.js:230:18
at runSyncOrAsync (/builds/internal/employee_portal/node_modules/loader-runner/lib/LoaderRunner.js:143:3)
at iterateNormalLoaders (/builds/internal/employee_portal/node_modules/loader-runner/lib/LoaderRunner.js:229:2)
at Array.<anonymous> (/builds/internal/employee_portal/node_modules/loader-runner/lib/LoaderRunner.js:202:4)
at Storage.finished (/builds/internal/employee_portal/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
at provider (/builds/internal/employee_portal/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9)
at /builds/internal/employee_portal/node_modules/graceful-fs/graceful-fs.js:90:16
at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
ERROR: Job failed: exit code 1

旁注:我正在处理的分支已经从主分支 checkout ,其他分支的更改没有包含在这个分支中。

我想知道:

  • 我的代码的哪一部分导致了这个错误(我怀疑强制清除缓存,但这只是一种预感)

  • 为什么我工作的分支的pipeline中没有出现这个错误?

  • 为什么运行程序在绑定(bind)了 更新 版本的 Node 时会报错?它不应该向后兼容吗?

我看过this link ,但我很好奇为什么这个错误在合并之前从未发生过,即使发生了,为什么它给我一个错误,因为我安装了一个更新的版本。

这是我的 gitlab-ci.yml 文件:

image: trion/ng-cli-karma

cache:
paths:
- node_modules/

build:
stage: build
script:
- npm cache clear --force
- npm i @angular/cli
- npm install
- npm run generate-docs
- ./node_modules/.bin/ng build --prod --base-href . --output-path www/
artifacts:
paths:
- www/
- documentation/
variables:
DOCKER_DRIVER: overlay

test:
stage: test
script:
- ./node_modules/.bin/ng test --code-coverage=true
artifacts:
paths:
- coverage/
coverage: '/(\d*.?\d+)%/'

pages:
stage: deploy
dependencies:
- build
- test
script:
- ls
- mv documentation www/
- mv coverage/ www/
- mv www/ public
- ls public/
artifacts:
paths:
- public
expire_in: 30 days

最佳答案

我遇到了同样的问题,npm rebuild node-sass 命令没有 对我有用。原因是 npm 缓存。如果您清除缓存,问题就会得到解决。

遵循的步骤:

  • 删除节点模块 rm -rf node_modules/
  • 删除缓存 npm cache clean --force
  • 验证缓存已删除 npm cache verify
  • npm 安装

关于docker - 错误 : Missing binding "binding.node" after merge to main branch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54585918/

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