繁体   English   中英

NPM 无法从 watchpack-chokidar2:fsevents 访问 CI 错误绑定

[英]NPM CI error bindings not accessible from watchpack-chokidar2:fsevents

当我在 Github 操作上运行npm ci时,出现错误:

Run npm ci
npm ERR! bindings not accessible from watchpack-chokidar2:fsevents

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2021-09-17T15_18_42_465Z-debug.log
Error: Process completed with exit code 1.

可以是什么?

我的.github/workflows/eslint.yaml

name: ESLint

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js
        uses: actions/setup-node@v1
        with:
          node-version: '14.x'
      - run: npm ci
      - run: npm run lint

我的package.json

{
  "name": "@blinktrade/uikit",
  "version": "1.0.0",
  "main": "dist/index.js",
  "license": "MIT",
  "devDependencies": {
    "@babel/plugin-transform-react-jsx": "^7.14.9",
    "@babel/preset-env": "^7.15.6",
    "@babel/preset-react": "^7.14.5",
    "@babel/preset-typescript": "^7.15.0",
    "@storybook/addon-essentials": "^6.3.8",
    "@storybook/react": "^6.3.8",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^12.1.0",
    "@testing-library/user-event": "^13.2.1",
    "@types/jest": "^27.0.1",
    "@types/react": "^17.0.21",
    "@typescript-eslint/eslint-plugin": "^4.31.1",
    "@typescript-eslint/parser": "^4.31.1",
    "eslint": "^7.32.0",
    "eslint-plugin-react": "^7.25.2",
    "husky": "^7.0.2",
    "jest": "^27.2.0",
    "prettier": "^2.4.1",
    "pretty-quick": "^3.1.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "rimraf": "^3.0.2",
    "typescript": "^4.4.3"
  },
  "husky": {
    "hooks": {
      "pre-push": "npm run lint",
      "pre-commit": "pretty-quick --staged"
    }
  },
  "scripts": {
    "build": "tsc -p .",
    "clear": "rimraf dist/",
    "format": "prettier '**/*' --write --ignore-unknown",
    "lint": "eslint --max-warnings=0 .",
    "storybook": "start-storybook -p 4000",
    "test": "jest"
  }
}

在我的例子中,我的测试突然开始失败,尽管已经工作了一段时间,尽管node_version与我的本地 Node 版本匹配,很奇怪。 只需在我的 GitHub Action 工作流程中将其更新为 16 即可解决问题并导致测试再次开始运行:

steps:
  - uses: actions/checkout@v3
  - uses: actions/setup-node@v3
    with:
      node-version: 16

解决了删除 packages-lock.json 并使用 NodeJS 14 再次运行的问题(原为 10)

actions\/setup-node@v1<\/code>必须在 GitHub 操作和已构建package-lock.json<\/code>的本地环境中具有相同的版本。 就我而言,GitHub 操作指向node 14<\/code> 。

      - uses: actions/setup-node@v1
        with:
          node-version: "14"

在构建图像设置中,我添加了“Node.js 版本 16.15”package。它对我有帮助!

对我来说帮助更新节点版本

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM