最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

解決自動(dòng)化部署npm安裝sass報(bào)錯(cuò),往往是node版本太高導(dǎo)致的問(wèn)題

 更新時(shí)間:2026年03月11日 16:33:18   作者:1024小神  
在使用GitHub Actions自動(dòng)化部署npm安裝sass時(shí)遇到報(bào)錯(cuò),原因是Node.js版本過(guò)高,本地開(kāi)發(fā)使用14.18.3版本,而GitHub Actions默認(rèn)使用最新版本,導(dǎo)致兼容性問(wèn)題,解決方法是指定與本地版本相近的Node.js版本,或者指定多個(gè)版本供GitHub Actions選擇

自動(dòng)化部署npm安裝sass報(bào)錯(cuò)

本想嘗試一下github的自動(dòng)化部署,將一個(gè)vue項(xiàng)目部署到github pages上面,結(jié)果報(bào)錯(cuò):

報(bào)錯(cuò)

npm ERR! code 1

50npm ERR! path /home/runner/work/CvReport/CvReport/node_modules/node-sass

51npm ERR! command failed

52npm ERR! command sh -c -- node scripts/build.js

53npm ERR! Building: /usr/local/bin/node /home/runner/work/CvReport/CvReport/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=

54npm ERR! gyp info it worked if it ends with ok

55npm ERR! gyp verb cli [

56npm ERR! gyp verb cli '/usr/local/bin/node',

57npm ERR! gyp verb cli '/home/runner/work/CvReport/CvReport/node_modules/node-gyp/bin/node-gyp.js',

58npm ERR! gyp verb cli 'rebuild',

59npm ERR! gyp verb cli '--verbose',

60npm ERR! gyp verb cli '--libsass_ext=',

61npm ERR! gyp verb cli '--libsass_cflags=',

62npm ERR! gyp verb cli '--libsass_ldflags=',

63npm ERR! gyp verb cli '--libsass_library='

64npm ERR! gyp verb cli ]

65npm ERR! gyp info using node-gyp@3.8.0

66npm ERR! gyp info using node@16.18.1 | linux | x64

67npm ERR! gyp verb command rebuild []

68npm ERR! gyp verb command clean []

69npm ERR! gyp verb clean removing "build" directory

70npm ERR! gyp verb command configure []

71npm ERR! gyp verb check python checking for Python executable "python2" in the PATH

72npm ERR! gyp verb `which` failed Error: not found: python2

73npm ERR! gyp verb `which` failed at getNotFoundError (/home/runner/work/CvReport/CvReport/node_modules/which/which.js:13:12)

74npm ERR! gyp verb `which` failed at F (/home/runner/work/CvReport/CvReport/node_modules/which/which.js:68:19)

75npm ERR! gyp verb `which` failed at E (/home/runner/work/CvReport/CvReport/node_modules/which/which.js:80:29)

76npm ERR! gyp verb `which` failed at /home/runner/work/CvReport/CvReport/node_modules/which/which.js:89:16

77npm ERR! gyp verb `which` failed at /home/runner/work/CvReport/CvReport/node_modules/isexe/index.js:42:5

78npm ERR! gyp verb `which` failed at /home/runner/work/CvReport/CvReport/node_modules/isexe/mode.js:8:5

79npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:202:21)

80npm ERR! gyp verb `which` failed python2 Error: not found: python2

81npm ERR! gyp verb `which` failed at getNotFoundError (/home/runner/work/CvReport/CvReport/node_modules/which/which.js:13:12)

82npm ERR! gyp verb `which` failed at F (/home/runner/work/CvReport/CvReport/node_modules/which/which.js:68:19)

83npm ERR! gyp verb `which` failed at E (/home/runner/work/CvReport/CvReport/node_modules/which/which.js:80:29)

84npm ERR! gyp verb `which` failed at /home/runner/work/CvReport/CvReport/node_modules/which/which.js:89:16

85npm ERR! gyp verb `which` failed at /home/runner/work/CvReport/CvReport/node_modules/isexe/index.js:42:5

86npm ERR! gyp verb `which` failed at /home/runner/work/CvReport/CvReport/node_modules/isexe/mode.js:8:5

87npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:202:21) {

88npm ERR! gyp verb `which` failed code: 'ENOENT'

89npm ERR! gyp verb `which` failed }

90npm ERR! gyp verb check python checking for Python executable "python" in the PATH

91npm ERR! gyp verb `which` succeeded python /usr/bin/python

92npm ERR! gyp ERR! configure error

93npm ERR! gyp ERR! stack Error: Command failed: /usr/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];

94npm ERR! gyp ERR! stack File "<string>", line 1

95npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];

96npm ERR! gyp ERR! stack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

97npm ERR! gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

98npm ERR! gyp ERR! stack

99npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:402:12)

100npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)

101npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1100:16)

102npm ERR! gyp ERR! stack at Socket.<anonymous> (node:internal/child_process:458:11)

103npm ERR! gyp ERR! stack at Socket.emit (node:events:513:28)

104npm ERR! gyp ERR! stack at Pipe.<anonymous> (node:net:301:12)

105npm ERR! gyp ERR! System Linux 5.15.0-1024-azure

106npm ERR! gyp ERR! command "/usr/local/bin/node" "/home/runner/work/CvReport/CvReport/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="

107npm ERR! gyp ERR! cwd /home/runner/work/CvReport/CvReport/node_modules/node-sass

108npm ERR! gyp ERR! node -v v16.18.1

109npm ERR! gyp ERR! node-gyp -v v3.8.0

110npm ERR! gyp ERR! not ok

111npm ERR! Build failed with error code: 1

112

113npm ERR! A complete log of this run can be found in:

114npm ERR! /home/runner/.npm/_logs/2022-12-13T06_06_26_664Z-debug-0.log

115Error: Process completed with exit code 1.

原因

node版本太高導(dǎo)致的,我本地開(kāi)發(fā)用的是14.18.3,但是使用github action部署的時(shí)候,如果不指定默認(rèn)的,就會(huì)用最新版的,所以就導(dǎo)致了不成功,需要指定和本地版本差不多的版本,或者指定多個(gè)版本:

name: Node.js CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [10.x, 12.x, 14.x, 15.x]

    steps:
      - uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm ci
      - run: npm run build --if-present
      - run: npm test

您也可以使用單個(gè)版本的 Node.js 構(gòu)建和測(cè)試:

name: Node.js CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - name: Use Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '12.x'
      - run: npm ci
      - run: npm run build --if-present
      - run: npm test

就會(huì)成功了:看吧,14成功了,15就失敗

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • 安裝pnpm及解決安裝失敗的過(guò)程

    安裝pnpm及解決安裝失敗的過(guò)程

    pnpm是一種高效的包管理工具,它通過(guò)共享依賴包存儲(chǔ)庫(kù)和符號(hào)鏈接技術(shù),節(jié)省磁盤(pán)空間、提高安裝速度并支持高效的更新,pnpm還兼容npm和Yarn的生態(tài),適合大型項(xiàng)目和頻繁安裝依賴的開(kāi)發(fā)團(tuán)隊(duì)使用
    2026-01-01
  • Nest 復(fù)雜查詢示例解析

    Nest 復(fù)雜查詢示例解析

    這篇文章主要為大家介紹了Nest 復(fù)雜查詢示例解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-12-12
  • Node.js事件的正確使用方法

    Node.js事件的正確使用方法

    這篇文章主要給大家介紹了關(guān)于Node.js事件的正確使用方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用Node.js具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04
  • Nodejs處理Json文件并將處理后的數(shù)據(jù)寫(xiě)入新文件中

    Nodejs處理Json文件并將處理后的數(shù)據(jù)寫(xiě)入新文件中

    這篇文章主要介紹了Nodejs處理Json文件并將處理后的數(shù)據(jù)寫(xiě)入新文件中,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-10-10
  • 在Node.js中處理Promise中錯(cuò)誤的示例代碼

    在Node.js中處理Promise中錯(cuò)誤的示例代碼

    在現(xiàn)代JavaScript開(kāi)發(fā)中,尤其在Node.js環(huán)境中,Promise已成為處理異步操作的重要方式,然而,Promise的錯(cuò)誤處理卻常常讓開(kāi)發(fā)者感到困惑,在這篇文章中,我們將深入探討如何在Node.js中處理Promise中的錯(cuò)誤,提供多個(gè)示例代碼,以便于理解和實(shí)踐,需要的朋友可以參考下
    2024-09-09
  • Node.js調(diào)用java之node-java問(wèn)題

    Node.js調(diào)用java之node-java問(wèn)題

    這篇文章主要介紹了Node.js調(diào)用java之node-java問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-10-10
  • node.js中的buffer.slice方法使用說(shuō)明

    node.js中的buffer.slice方法使用說(shuō)明

    這篇文章主要介紹了node.js中的buffer.slice方法使用說(shuō)明,本文介紹了buffer.slice的方法說(shuō)明、語(yǔ)法、接收參數(shù)、使用實(shí)例和實(shí)現(xiàn)源碼,需要的朋友可以參考下
    2014-12-12
  • Nodejs實(shí)現(xiàn)定時(shí)爬蟲(chóng)的完整實(shí)例

    Nodejs實(shí)現(xiàn)定時(shí)爬蟲(chóng)的完整實(shí)例

    這篇文章主要給大家介紹了關(guān)于Nodejs實(shí)現(xiàn)定時(shí)爬蟲(chóng)的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-03-03
  • Node.js利用js-xlsx處理Excel文件的方法詳解

    Node.js利用js-xlsx處理Excel文件的方法詳解

    這篇文章主要給大家介紹了關(guān)于Node.js利用js-xlsx處理Excel文件的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起看看吧。
    2017-07-07
  • 深入理解Node中的buffer模塊

    深入理解Node中的buffer模塊

    本篇文章主要介紹了Node中的buffer,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-06-06

最新評(píng)論

清流县| 巴塘县| 沁阳市| 黄冈市| 永丰县| 城固县| 通榆县| 兴山县| 乃东县| 固阳县| 松原市| 灌南县| 双鸭山市| 库车县| 陵川县| 新巴尔虎左旗| 平阴县| 施甸县| 隆昌县| 平乐县| 光山县| 政和县| 福鼎市| 姜堰市| 南汇区| 开鲁县| 河西区| 德令哈市| 志丹县| 新宾| 辛集市| 湟源县| 衡阳县| 张家口市| 中西区| 禄丰县| 湘潭市| 太原市| 石阡县| 东海县| 全州县|