현재 Firebase에서 호스팅되는 React 앱에 대해 GitLab을 통해 CI를 설정하려고합니다. 나는이 지점을지나 치기 위해 고군분투하고있다. sudo 사용을 제안하는 다른 게시물이 있었지만 콘솔에서 명령을 찾을 수 없다고 말했습니다.
어떤 도움이라도 대단히 감사하겠습니다. 감사합니다.
내 현재 구성은 다음과 같습니다.
gitlab-ci.yml 구성 파일
image: node:10.15.3
cache:
paths:
- node_modules/
stages:
- build
- deploy
deploy_dev:
stage: deploy
script:
- echo "Deploying to staging environment"
- npm install -g firebase-tools
- firebase deploy --token $FIREBASE_DEPLOY_KEY --project $CI_ENVIRONMENT_NAME
environment:
name: dev
only:
- master
Package.json
{
"name": "react-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"bootstrap": "^4.4.1",
"firebase": "^6.6.2",
"firebase-functions": "^3.3.0",
"moment": "^2.24.0",
"node-sass": "^4.13.1",
"react": "^16.12.0",
"react-beautiful-dnd": "^11.0.5",
"react-dates": "^20.3.0",
"react-dom": "^16.12.0",
"react-moment": "^0.9.7",
"react-perfect-scrollbar": "^1.5.3",
"react-router-dom": "^5.1.2",
"react-scripts": "^3.3.0",
"reactstrap": "^8.2.0",
"recompose": "^0.30.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
권한 오류를 나타내는 콘솔 오류
$ firebase deploy -m "Pipeline $CI_PIPELINE_ID, build $CI_BUILD_ID" --non-interactive --token $FIREBASE_DEPLOY_KEY --project $CI_ENVIRONMENT_NAME
⚠ functions: package.json indicates an outdated version of firebase-functions.
Please upgrade using npm install --save firebase-functions@latest in your functions directory.
=== Deploying to 'cmd-dev-bbdc4'...
i deploying functions, hosting
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint /builds/cmdc/cmd/functions
> eslint .
sh: 1: eslint: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! functions@ lint: `eslint .`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-02-03T01_51_09_788Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code126
ERROR: Job failed: exit code 1
그래서 몇 가지 실험을 통해 'functions'디렉토리로 이동하고 NPM 설치를 실행해야한다는 것을 알 수있었습니다. Firebase 프로젝트의 구조와 노드 패키지에 대한 근본적인 오해 때문이라고 생각합니다.
나는 더 많은 것을 배우고 싶기 때문에 누군가 이것에 대해 읽는 것을 공유한다면 감사 할 것입니다.
다음과 같은 스크립트로 끝났습니다.
deploy_dev:
stage: deploy
script:
- echo "Deploying to staging environment"
- npm install -g firebase-tools #--allow-root
- npm ci #--allow-root
- cd functions # required or would throw the "eslint: not found" error
- npm ci
- cd ..
- firebase use --token $FIREBASE_DEPLOY_KEY $CI_ENVIRONMENT_NAME
- firebase deploy -m "Pipeline $CI_PIPELINE_ID, build $CI_BUILD_ID" --non-interactive --token $FIREBASE_DEPLOY_KEY
environment:
name: dev
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다