错误:合并到主分支后缺少绑定“ binding.node”

时间:2019-02-08 04:16:53

标签: docker continuous-integration gitlab pipeline continuous-deployment

我试图在GitLab的一个分支中配置CI / CD中的自动代码覆盖,并且管道在分支中完美通过,但是当管理员将更改合并到主分支中时,由于丢失了管道,因此失败绑定。

我使用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 

旁注:我正在处理的分支已从主分支中签出,该分支中未包含其他分支的更改。

我想知道:

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

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

  • 当跑步者具有对更新版本的Node的绑定时,为什么跑步者会出错?它不应该向后兼容吗?

我看过this link,但是我很好奇为什么在合并之前从未发生此错误,即使发生了,为什么会因为我 updated < / strong>版本。

这是我的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

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,#define d2r (M_PI / 180.0) +(float) haversine_km:(float)lat1: (float)long1: (float)lat2: (float)long2 { float dlong = (long2 - long1) * d2r; float dlat = (lat2 - lat1) * d2r; float a = pow(sin(dlat/2.0), 2) + cos(lat1*d2r) * cos(lat2*d2r) * pow(sin(dlong/2.0), 2); float c = 2 * atan2(sqrt(a), sqrt(1-a)); float d = 6367 * c; return d; } 命令没有对我有用。原因是npm缓存。如果清除缓存,则问题将得到解决。

遵循的步骤:

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