Firebase 使用Circleci将盖茨比部署到火力基地

Firebase 使用Circleci将盖茨比部署到火力基地,firebase,gatsby,firebase-hosting,circleci,firebase-tools,Firebase,Gatsby,Firebase Hosting,Circleci,Firebase Tools,我跟随这个博客使用circleCI将我的盖茨比网站部署到Firebase config.yml文件如下所示 # CircleCI Firebase Deployment Config version: 2 jobs: build: docker: - image: circleci/node:10 working_directory: ~/gatsby-site steps: - checkout - restore_cache:

我跟随这个博客使用circleCI将我的盖茨比网站部署到Firebase

config.yml文件如下所示

# CircleCI Firebase Deployment Config
version: 2
jobs:
  build:
    docker:
      - image: circleci/node:10
    working_directory: ~/gatsby-site
    steps:
      - checkout
      - restore_cache:
          keys:
            # Find a cache corresponding to this specific package-lock.json
            - v1-npm-deps-{{ checksum "package-lock.json" }}
            # Fallback cache to be used
            - v1-npm-deps-
      - run:
          name: Install Dependencies
          command: npm install
      - save_cache:
          key: v1-npm-deps-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules
      - run:
          name: Gatsby Build
          command: npm run build
      - run:
          name: Firebase Deploy
          command: ./node_modules/.bin/firebase deploy --token "$FIREBASE_TOKEN"
这导致了一个错误

#!/bin/bash -eo pipefail
./node_modules/.bin/firebase deploy --token "$FIREBASE_TOKEN"
/bin/bash: ./node_modules/.bin/firebase: No such file or directory

Exited with code exit status 127
CircleCI received exit code 127
我以前没有使用过yml文件,也没有关注过devops,所以做了一些挖掘。发现其他一些人有此问题,并建议使用工作区和工作流。所以我修改了我的yml文件来支持这一点

# CircleCI Firebase Deployment Config
version: 2
jobs:
  #build jobs
  build:
    docker:
      - image: circleci/node:10
    working_directory: ~/gatsby-site
    steps:
      - checkout
      - restore_cache:
          keys:
            # Find a cache corresponding to this specific package-lock.json
            - v1-npm-deps-{{ checksum "package-lock.json" }}
            # Fallback cache to be used
            - v1-npm-deps-
      - run:
          name: Install Dependencies
          command: npm install
      - save_cache:
          key: v1-npm-deps-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules
      - persist_to_workspace:
          root: ./
          paths:
            - ./
      - run:
          name: Gatsby Build
          command: npm run build
      - persist_to_workspace:
          root: ./
          paths:
            - ./
  # deploy jobs
  deploy-production:
    docker:
      - image: circleci/node:10
    steps:
      - attach_workspace:
          at: ./  
      - run:
          name: Firebase Deploy
          command: ./node_modules/.bin/firebase deploy --token "$FIREBASE_TOKEN"
workflows:
  version: 2
  build:
    jobs:
    #build
      - build
    #deploy
      - deploy-production:
          requires:
            - build
同一问题

#!/bin/bash -eo pipefail
./node_modules/.bin/firebase deploy --token "$FIREBASE_TOKEN"
/bin/bash: ./node_modules/.bin/firebase: No such file or directory

Exited with code exit status 127
CircleCI received exit code 127

我想这一定与路径有关,它在错误的目录中查找?你知道我怎样才能找到所需的模块吗?

显然我看不懂。修复方法在说明书中

我们还需要将firebase tools包本地安装到 作为开发依赖项的项目。这将在以后使用时派上用场 与CircleCI集成,不允许安装软件包 默认情况下为全局。让我们现在就安装它:

npm安装-D firebase工具


firebase工具
是否列在您的
package.json
中?您让我开心了!npm安装-D firebase工具完成了这一任务