React app deploys fine through local cli,
though on github actions it fails with error:
sh: 1: firebase: not found
Error: Process completed with exit code 127.
package.json:
"scripts": {
"start": "react-scripts start",
"build": "CI=false react-scripts build && firebase deploy -P riplir",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
What am I doing wrong here?
I would assume from this that you have the firebase executable on your desktop and not in the pipeline. Whilst the pipeline could be totally valid commands and configuration for firebase, it won't be able to do anything without the executable.
Try adding a pre-requisite command like:
npm init
npm install --save firebase
Or using an image that is guaranteed to have an up to date version of the firebase executable present.
See the Firebase package for more information.
Related
I am planning to deploy the frontend with Next.js and the backend with springboot.
Even though I built next.js, next.js still print out the following error.
Could not find a production build in the
'C:\Users\tojaeung\Desktop\blog\frontend.next' directory. Try
building your app with 'next build' before starting the production
server. https://nextjs.org/docs/messages/production-start-no-build-id
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
Since i help you to solve this ploblem, i wrote the folling log when i build app of next.js.
Loaded env from
C:\Users\tojaeung\Desktop\blog\frontend.env.production info -
Linting and checking validity of types ..error - ESLint: Failed to
load config "plugin:prettier/recommand" to extend from. Referenced
from: C:\Users\tojaeung\Desktop\blog\frontend.eslintrc.json info -
Linting and checking validity of types info - Disabled SWC as
replacement for Babel because of custom Babel configuration ".babelrc"
https://nextjs.org/docs/messages/swc-disabled info - Using
external babel configuration from
C:\Users\tojaeung\Desktop\blog\frontend.babelrc (node:6312)
[DEP_WEBPACK_MODULE_UPDATE_HASH] DeprecationWarning:
Module.updateHash: Use new ChunkGraph API (Use node --trace-deprecation ... to show where the warning was created) info - Creating an optimized production build info - Compiled successfully
As you can see, it's built without a problem.
What is the cause of this problem?
I am trying to add tailwind css in my react app created with create react app. There is error in build:styles script. Error says like this postcss src/tailwind.css -o src/styles.css Error: true is not a PostCSS plugin. I followed different resources but I am stuck with same error. This is the one article im referring dev
Can you please check the below code? Hope it will work for you. You can try this way, it might be helpful for you.
"scripts": {
"start": "react-scripts start",
"build": "npm run build:styles && react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"build:styles": "postcss src/tailwind.css -o src/styles.css",
}
I've followed all the steps in here to get the "Classy Taxi: Google Play Billing Subscriptions Android App Java Sample" running, however on the last step I'm very confused, it´s not clear to me as to how I´m supposed to deploy the back-end, here are the steps:
These are steps to build the backend server code located here
Make sure you have installed Node.js, npm, and Firebase CLI.
Run npm install to install dependencies.
Configure Cloud Functions for Firebase with your Android app and subscription products:
firebase use --add {your_firebase_project_id}
firebase functions:config:set app.package_name="your_android_application_id"
firebase functions:config:set app.basic_plan_sku="your_basic_subscription_product_sku_id"
firebase functions:config:set app.premium_plan_sku="your_premium_subscription_product_sku_id"
Run firebase deploy to deploy your backend to Cloud Functions for Firebase.
On the steps it´s not clear as to how the server will be deployed, it only mentioned the app id and the products SKU´s but not the code for the server so I need help clarifying that, please. I would like to see steps by step how to deploy the server.
This is what I´m currently doing:
1. Go to the root folder for the server
2. Open cmd from that folder
3. run the commands listed on the docs.
4. then I get this error:
=== Deploying to 'billing-project-c9f03'...
i deploying functions, hosting
Running command: npm --prefix "$RESOURCE_DIR" run lint
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\frank\Desktop\Billing app\ClassyTaxiServer\server\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\frank\Desktop\Billing app\ClassyTaxiServer\server\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\frank\AppData\Roaming\npm-cache\_logs\2020-04-13T01_21_30_198Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code429496323
But I see the package.json file on the root folder.
See the Firebase CLI reference. This should be the project's root directory ClassyTaxiServer; assuming that you've ran all previous steps successfully, before attempting to firebase deploy. firebase.json knows what to do... however, that file is the actual problem; see PR #289.
Update firebase.json to this version and it should work out:
{
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
],
"source": "."
},
"hosting": {
"public": "webapp",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ ]
}
}
I'm trying to deploy my firebase functions but all the functions return me error, I had already deployed before without any error.
I did not install anything new since the last time that a deploy was correct.
Every functions return almost the same error, the only thing that changes is the "errorId"
I have tried to logout from firebase-cli and login again, i have updated firebase-tools, firebase-admin, firebase-functions from npm.
I'm deploying with firebase deploy --only functions
Deployment error.
Build failed:
{
"error": {
"canonicalCode": "INVALID_ARGUMENT",
"errorMessage": "`npm_install` had stderr output:\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/#types/lodash-973f4ada/common/collection.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/#types/node-29231f2f/inspector.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/#types/node-f1c8db24/inspector.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/#firebase/auth-1b85ce5b/dist/auth.esm.js.map'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/#firebase/webchannel-wrapper-e6854ec7/dist/index.js'\nnpm ERR! code E404\nnpm ERR! 404 Not Found: grpc#1.20.1\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /builder/home/.npm/_logs/2019-06-08T18_16_17_266Z-debug.log\n\nerror: `npm_install` returned code: 1",
"errorType": "InternalError",
"errorId": "FD2536C1"
}
}
Package.json :
{
"name": "functions",
"engines": {
"node": "8"
},
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": {
"#firebase/storage": "^0.2.16",
"#google-cloud/vision": "^0.24.0",
"#sendgrid/mail": "^6.4.0",
"cors": "^2.8.5",
"dateformat": "^3.0.3",
"firebase": "^5.11.1",
"firebase-admin": "^7.4.0",
"firebase-functions": "^2.3.1",
"json2csv": "^4.5.1",
"mailchimp-api-v3": "^1.13.0",
"moment-timezone": "^0.5.25",
"openpay": "^1.0.3",
"paypal-rest-sdk": "^1.8.1",
"request": "^2.88.0"
},
"devDependencies": {
"eslint": "^4.12.0",
"eslint-plugin-promise": "^3.6.0",
"firebase-functions-test": "^0.1.6"
},
"private": true
}
Correct deploy of the functions.
Update***
I have tried to delete everything and uninstall every package except for the ones required for firebase-functions and start over with one test function in node 8 i'm having the same issue, with node 6 it was deployed, but i need to use node 8 because i need to use await/async
I had a similar deployment failure. I think it was caused by me running firebase deploy from the app directory rather the the app\functions directory. In any case, I ran the following commands from the terminal (using VSCode in my case) having changed into the app\functions directory. Deployment then worked perfectly.
npm install --save #google-cloud/storage
npm install --save firebase-admin#latest
npm install --save firebase-functions#latest
firebase deploy
Hope that helps.
Checking the log
You can examine the actual logs by using this command to open the log
firebase functions:log
Doing this is really helpful since specific issue will usually be visible there. I sometimes even had error as simple as a missing package name in package.json
It would have been much helpful if firebase could show better info on the errors directly. but at least we can find them here.
I hope it helps
I had similar issue and it ended up being a missing module in my package.json
You can view more detailed / useful logs here: https://console.cloud.google.com/logs
Firebase functions:log really helps! In my case I had not enabled signin method in the firebase project (:
Following the firebase function getting started guide and getting a seemingly simple error once trying to deploy with:
firebase deploy --only functions
i deploying functions
Running command: npm --prefix $RESOURCE_DIR run lint
npm ERR! path C:\Users\Beat\leginformant\$RESOURCE_DIR\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open
'C:\Users\Beat\leginformant\$RESOURCE_DIR\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
The package.json file does exist just as the tutorial shows in my project/functions/package.json.
Have tried changing or printing out the RESOURCE_DIR env with no success. Assuming it would be scoped inside of the NPM shell environment.
npm version: 5.6.0
node version: 8.9.0
This is a known problem with the Firebase CLI 3.17.0 through at least 3.17.3, but only on Windows. You can fix this on your machine by editing firebase.json at the root of your project and replacing $RESOURCE_DIR with %RESOURCE_DIR% in the npm commands you see there. The former is the unix syntax way to use an environment variable, whereas the latter is the Windows command shell syntax. Since you're using Windows, you need to use the Windows syntax.
The team is looking into ways to prevent having to make changes to the config files you use, as it's not really convenient for teams that works across platform to keep changing the same file back and forth.
EDIT: This issue should be fixed with projects created with CLI version 3.17.5.
When running
firebase init functions
I use this configuration
? What language would you like to use to write Cloud Functions? JavaScript
//TypeScript doesn't work
? Do you want to use ESLint to catch probable bugs and enforce style? Yes
//If you don't you will get a missing file lint
? File functions/package.json already exists. Overwrite? Yes
? Do you want to install dependencies with npm now? Yes
//Why not
Then if use windows
Replace $RESOURCE_DIR by %RESOURCE_DIR% in firebase.json
In windows, while Initializing the firebase Project in CLI using firebase init,In firebase.json file,Change the code to as per below{
"functions": {
"predeploy": [
"npm --prefix \"%RESOURCE_DIR%\" run lint"
],
"source": "functions"
}
}
After this change, try firebase deploy --only functions command.
Change the following:
npm --prefix \"$RESOURCE_DIR\" run lint
to
npm --prefix \"%RESOURCE_DIR%\" run lint
in firebase.json file in main structure
{
"functions": {
"predeploy": [
"npm --prefix \"%RESOURCE_DIR%\" run lint"
],
"source": "functions"
}
}
You can fix this by accessing your firebase.json file and delete this line containing RESOURCE_DIR.
Apart from the other suggestions, if you change the preflight/predeploy command from:
"npm --prefix \"$RESOURCE_DIR\" run lint", OR
"npm --prefix \"%RESOURCE_DIR%\" run lint"
to
"npm --prefix ./functions run lint"
the issue seems to get fixed. This also resolves it for both Windows and Linux.
To see more details, please see this answer (and further thread): https://github.com/firebase/firebase-tools/issues/610#issuecomment-360147507
You have to change firebase.json file as shown in here
"npm --prefix functions run lint"
"npm --prefix functions run build"
As an extra doing npm --prefix %RESOURCE_DIR% run lint like #Deji James said, made me some progress but still didn't work.
As a suggestion I found this
https://github.com/firebase/firebase-tools/issues/610
and #merlinnot says here
Hey guys, you all probably have sth in your predeploy in firebase.json, don't you? Just delete what you have there for now if it's not that important.
worked for me.
PS. before deciding to delete, I have done all reinstall things, uninstall things. Only this is worked.
For ubuntu you need to change firebase.json to following, notice $ before RESOURCE_DIR
{
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
}
for Windows 10 you need to change firebase.jsonn to following, notice % after and before RESOURCE_DIR
{
"functions": {
"predeploy": [
"npm --prefix \"%RESOURCE_DIR%\" run lint",
"npm --prefix \"%RESOURCE_DIR%\" run build"
]
}
}
(for Windows no idea if it work in ios or not)Just delete everything under "Predeploy":
it should look like
"predeploy": [ ],
and this work for me hope it will solve your problem also
i find this solution here