【问题标题】:Node-sass version issues with node and npm GitLabnode 和 npm GitLab 的 node-sass 版本问题
【发布时间】:2021-07-21 17:37:12
【问题描述】:

我在 gitlab 中的.yml 文件是这样的

stages:
  - prepare_build
  - save_build
  - deployment
image: node:latest
cache:
  paths:
  - node_modules/
prepare_build:
  stage: prepare_build
  script:
  - npm install
  - npm run build
  artifacts:
    paths:
      - build

下面是我的package.json 文件,其中包含node-sasssass-loader

"node-sass": "^4.14.1",
"sass-loader": "^7.0.1",

我的本​​地机器,构建成功,它有 node 和 npm 版本

node : 14.5.0
npm : 6.14.8

下面是我的 GitLab 构建错误

npm ERR! code 1
npm ERR! path /builds/../../node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /usr/local/bin/node /builds./../.././node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=

我必须在package.json 中更新哪些版本组合? TIA

【问题讨论】:

  • 是的,你必须将版本组合放在 package.json 中
  • @GopalJoshi 最新节点的组合是什么?

标签: node.js npm gitlab package.json node-sass


【解决方案1】:

如果不指定节点镜像,​​默认是最新的,与你使用的node-sass版本不兼容,尝试在构建作业中指定节点镜像的版本:

prepare_build:
  image: node: 10.15.3
  ...

【讨论】:

    猜你喜欢
    • 2022-08-11
    • 2017-06-16
    • 2022-11-01
    • 2019-04-03
    • 1970-01-01
    • 1970-01-01
    • 2022-12-18
    • 2020-09-11
    • 1970-01-01
    相关资源
    最近更新 更多