简体   繁体   中英

npm install error in Bitbucket CI/CD pipeline

I have a pipeline set up for my Bitbucket repository that runs npm install if there is no node cache. Up until now it has worked fine, but the node cache was recently cleared, and now I'm getting the following output from Bitbucket (Pastebin link, due to character limit): https://pastebin.com/fY9TznNn

package.json :

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "@types/geojson": "^7946.0.7",
    "@types/google-libphonenumber": "^7.4.19",
    "@types/google-map-react": "^2.1.0",
    "@types/jest": "^24.0.0",
    "@types/node": "^12.12.55",
    "@types/react": "^16.9.49",
    "@types/react-bootstrap": "^0.32.22",
    "@types/react-dom": "^16.9.8",
    "@types/react-modal": "^3.10.6",
    "@types/react-router-dom": "^5.1.5",
    "@types/supercluster": "^5.0.2",
    "axios": "^0.21.1",
    "bootstrap": "^4.5.2",
    "enzyme": "^3.11.0",
    "eslint": "^6.8.0",
    "firebase": "^7.24.0",
    "geojson": "^0.5.0",
    "google-libphonenumber": "^3.2.14",
    "google-map-react": "^2.1.3",
    "node-sass": "^4.0.0",
    "react": "^16.13.1",
    "react-async": "^10.0.1",
    "react-bootstrap": "^1.3.0",
    "react-cool-img": "^1.2.4",
    "react-dom": "^16.13.1",
    "react-dropzone": "^11.3.2",
    "react-modal": "^3.12.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "^3.4.4",
    "supercluster": "^7.1.0",
    "typescript": "^3.2.1",
    "use-supercluster": "^0.2.9"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "lint": "npx prettier --write src && npx eslint src --fix --ext .ts --ext .tsx"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@types/enzyme": "^3.10.8",
    "@types/enzyme-adapter-react-16": "^1.0.6",
    "@typescript-eslint/eslint-plugin": "^3.10.1",
    "@typescript-eslint/parser": "^3.10.1",
    "enzyme": "^3.11.0",
    "enzyme-adapter-react-16": "^1.15.6",
    "eslint": "^7.23.0",
    "eslint-config-airbnb": "^18.2.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-import": "^2.22.0",
    "eslint-plugin-jsx-a11y": "^6.3.1",
    "eslint-plugin-promise": "^4.3.1",
    "eslint-plugin-react": "^7.20.6",
    "eslint-plugin-react-hooks": "^4.1.0",
    "eslint-plugin-sort-keys-fix": "^1.1.1",
    "prettier": "^2.1.1"
  }
}

bitbucket-pipelines.yml :

image: node

definitions:
  steps:
    - step: &lint
        name: Check code style
        script:
          - npm install # this is where the error occurs
          - npx eslint **/*.ts[x]
        caches:
          - node
    - step: &build
        name: Build and test
        script:
          - echo > ".env"
          - echo REACT_APP_GOOGLE_API_KEY=$GOOGLE_API_KEY >> ".env"
          - echo REACT_APP_HANDSHAKE_API_KEY=$HANDSHAKE_API_KEY >> ".env"
          - npm install
          - npm run test
          - npm run build
        artifacts:
          - build/**
        caches:
          - node
    - step: &deploy
        name: Deploy to Firebase
        script:
          - cd functions
          - npm install
          - cd ..
          - pipe: atlassian/firebase-deploy:1.0.0
            variables:
              FIREBASE_TOKEN: $FIREBASE_TOKEN
              PROJECT_ID: $FIREBASE_PROJECT

pipelines:
  pull-requests:
    "**":
      - step: *lint
      - step: *build

  branches:
    master:
      - step: *lint
      - step: *build
      - step: *deploy

I'm concerned it might have something to do with the node-sass package as I've experienced issues with it before, and it's the first dependency to appear in the error. But I'm really not sure how to interpret this output or how to fix it. Thanks for any help!

Looks like my intuition was right—it was because of the node-sass package. Apparently it's deprecated . Installing sass instead fixed the problem!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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