Unable to deploy app on firebase using Google Cloud build ! Getting error "exec user process caused "no such file or directory" - devops

Hi I am trying to automate task of deployment using Google Cloud build to trigger the build & deploy whenever code is pushed into master branch .
But I am getting error , in the step 2 of the build ( Deploy step )
"exec user process caused "no such file or directory"
Here are my Files :
cloudbuild.yaml
steps:
# Install node packages
- name: node:12.13.1
entrypoint: npm
args: ['install']
# Build productive files
- name: node:12.13.1
entrypoint: npm
args: [ 'run', 'build', '--prod' ]
# Deploy
- name: 'gcr.io/$PROJECT_ID/firebase'
args: ['deploy', '--project', 'dive-testing-268508', '--token', 'YYY']
Where YYY is repalced with token value ,
firebase.json
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
package.json
{
"name": "ocean-aifrontend",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
output path in angular.json
"outputPath": "dist",
I am unable to understand the root cause behind this !Please let me know if any further info is required for sorting this issue . Thanks

The source of this error might be due to the entrypoint for Docker in your firebase.bash file is set up for Windows, not Linux.
You may want to take a look at this issue and how it was resolved.

Related

AWS CDK Code Pipeline Development - Typescript Error TS2307

Problem:
Whilst developing my Code Pipeline, I am experiencing a new error I did not receive with cdk deploy --all in the CLI. All stacks deploy successfully.
Code Build Error Message:
src/lambda-handlers/queue-consumers/intoMagentoQueueConsumer/index.ts(3,75): error TS2307: Cannot find module '#aws-sdk/client-sfn' or its corresponding type declarations.
Lambda Function Import Statements:
import { SFNClient, SendTaskSuccessCommand, SendTaskFailureCommand } from "#aws-sdk/client-sfn";
Lambda Function Package.json:
{
"name": "intomagentoqueueconsumer",
"module": "commonjs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#aws-sdk/client-sfn": "^3.226.0",
"axios": "^1.2.1",
"axios-retry": "^3.3.1"
}
}
Lambda Function CDK Definition:
this.intoMagentoQueueConsumer = new NodejsFunction(this, `intoMagentoQueueConsumer`, {
runtime: Runtime.NODEJS_16_X,
handler: "handler",
depsLockFilePath: join(__dirname, "../../src/lambda-handlers/queue-consumers/intoMagentoQueueConsumer/package-lock.json"),
entry: join(__dirname, "../../src/lambda-handlers/queue-consumers/intoMagentoQueueConsumer/index.ts"),
bundling: { minify: false, nodeModules: ["#aws-sdk/client-sfn", "axios", "axios-retry"], externalModules: ["aws-sdk", "crypto-js"] },
});
Porting the solution from the comments for posterity:
Do you have mismatched npm CLI versions? AWS CodeBuild tsc error TS2307: Cannot find module.
I understand your project has multiple package.json. In your pipeline ShellStep commands, make sure you are running npm ci for each one to install the dependencies.

Building cypress image via Dockerfile VS running tests by pulling and starting the image

I'm experiencing different behavior when I'm building a custom cypress container (custom in a sense that it contains randomstring package)
VS when I pull the image from the Docker Hub and map integration tests to it and start it.
In first scenerio I'm not getting any output from tests. In the second scenerio
I'm getting output but it won't install the randomstring package hence my tests
are failing.
My Dockerfile:
FROM cypress/base:12
WORKDIR /e2e
COPY cypress.json /e2e/cypress.json
COPY package.json /e2e/package.json
ENV CI=1
RUN npm i
CMD ["npm","cypress","run"]
cypress.json :
{
"name": "e2e",
"version": "0.1.0",
"private": true,
"dependencies": {
"randomstring": "^1.2.2",
"cypress": "^10.0.0"
},
"scripts": {
},
"eslintConfig": {
"extends": []
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
}
}
How can I get test output from container working and to use the randomstring package ?

Built electron app only prints json to screen

I just wrote my first Electron app. Now I'm trying to build it through electron-packager. My package.json looks like this:
{
"name": "pixelcast",
"productName": "pixelcast",
"version": "0.0.1",
"author": "Wesley Peeters <wesley#youngones.works>",
"description": "Caster",
"license": null,
"main": "./dist/electron/main.js",
"scripts": {
"build": "node .electron-vue/build.js",
"build:darwin": "cross-env BUILD_TARGET=darwin node .electron-vue/build.js",
"build:linux": "cross-env BUILD_TARGET=linux node .electron-vue/build.js",
"build:mas": "cross-env BUILD_TARGET=mas node .electron-vue/build.js",
"build:win32": "cross-env BUILD_TARGET=win32 node .electron-vue/build.js",
"build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
"build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
"dev": "node .electron-vue/dev-runner.js",
"pack": "build --dir",
"dist": "build",
"pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js",
"pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
"postinstall": ""
},
"build": {
"appId": "nl.pixelservers.caster",
"win": {
"icon": "build/test.png",
"target": [
"portable"
]
}
},
}
this all works fine, but when I open the built app, this is my result:
How can I go about debugging an issue like this?
thanks.
(This might be more of a "comment" than an answer but I couldn't add the detail and image in comment)
It is hard to say without knowing how your project is structured. I use both electron-packager and electron-builder. The "dist" directory is solely for output so it is weird to me that you are referencing a script in that directory:
"main": "./dist/electron/main.js",
Given my project structure (shown below), I have "main.js" at the same level as "project.json" so:
"main": "main.js",
But maybe you have your project structured in a way which supports the way you are referencing "main.js"? . I'm using only electron-packager in the project below so no "dist" folder – I have the "release-builds" folder instead. My scripts for building look like this:
"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --asar --prune=true --out=release-builds",
"package-win": "electron-packager . --overwrite --platform=win32 --arch=ia32 --asar --prune=true --out=release-builds"

node modules not found after packaging electron app with electron-forge for window

Electron app was initialized using electron-forge webpack template and everything works perfectly for macOs.
While running the dev version using electron-forge start the app loads perfectly on windows.
Once the app is packaged for windows using electron-forge make the build completes successfully. But while running the packaged app Cannot find module X is thrown.
The folder ./out/app/resources/app/node_modules is empty.
Also the package.json ./out/app/resources/app/package.json looks as follows.
"name": "my-app",
"productName": "my-app",
"version": "1.0.0",
"description": "My Electron application description",
"main": ".webpack/main",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
},
"keywords": [],
"author": {
"name": "",
"email": ""
},
"license": "MIT",
"config": {},
"dependencies": {},
"devDependencies": {},
"optionalDependencies": {},
"peerDependencies": {}
}
None of the dependencies in the source package.json made it to the packaged app.
Try this
cd "my-app"
:: install dependency into your node_modules and update your package.json
npm install your-dependency --save-prod
npm run make

How to Publish to a Private GitHub with Electron-builder NSIS and AppImage?

Electron-builder Version: 20.38.5
Target: Windows ia32 and x64
I'm trying to push the project to GitHub releases in a private repository.
The main target is Win ia32 and x64.
I set the token in the console by:
set GH_TOKEN=<blabla>
And at the package.json file:
"publish": {
"provider": "github",
"repo": "electron-todo-tasks",
"owner": "AndreD23",
"host": "github.com",
"protocol": "https",
"releaseType": "draft",
"token": "<blablabla>",
"private": true
}
I'm the only one who will have access to the project, so updating the token in the file apparently not a problem.
But, when I run:
electron-builder --x64 --ia32 --publish always
It shows me the error:
Error: Cannot cleanup:
Error #1 --------------------------------------------------------------------------------
HttpError: 404 Not Found
"method: undefined url: https://github.com/repos/AndreD23/electron-todo-tasks/releases\n\nPlease double check that your authentication token is correct. Due to security reasons actual status maybe not reported, but 404.\n"
I'll attach the whole error.
2019-03-22T13_04_27_992Z-debug.log
electron publish error.txt
I tried to change the option always to onTag or onTagOrDraft and change releaseType to release.
I tried to manually create a draft on GitHub first, doesn't work.
I tried to make the repository public for tests, not working too.
I tried to regenerate the token twice and updated the envs, console and package.json, doesn't work.
Is there any configuration that I've missed? What I have to do for Electron to publish to GitHub?
At the error, it says that cannot find https://github.com/repos/AndreD23/electron-todo-tasks/releases. Opening it on the web browser, it returns 404. I find the link a bit strange because it adds the word repos after github.com, and removing it in the browser it loads fine. This word is setting automatically?
Thanks #edelCustodio
Reference: https://github.com/electron-userland/electron-builder/issues/3776#issuecomment-486888574
This worked for me, on PowerShell type this
[Environment]::SetEnvironmentVariable("GH_TOKEN","my-personal-token","User")
and be sure that you package.json will be like this:
"build": {
"appId": "com.friasoftit.electron-auto-update",
"productName": "Electron Auto Update",
"publish": [
{
"provider": "github",
"owner": "edelCustodio",
"repo": "electron-auto-update"
}
],
"win": {
"publish": [
"github"
],
"target": [
{
"target": "nsis",
"arch": [
"x64",
"ia32"
]
}
]
}
},
And then I run this command yarn run publish and this is how my publish is on my package.json
"publish": "build --win -p always"
Don't forget to close and open a new PowerShell terminal.
Run windows powerShell from Administrator
Execute [Environment]::SetEnvironmentVariable("GH_TOKEN","<git_hub_token>","User")
Launch or full restart your IDE
Run bozon package windows --publish
Config:
{
"name": "",
"version": "",
"description": "",
"author": "",
"repository": "<repo_url>",
"dependencies": {
"cross-fetch": "^3.0.6",
"electron-builder": "^22.10.5",
"file-loader": "^6.2.0",
"luxon": "^1.26.0",
"node-fetch": "^2.6.1"
},
"license": "ISC",
"devDependencies": {
"bozon": "1.1.3",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"jest": "26.6.3",
"spectron": "13.0.0"
},
"build": {
"appId": "",
"publish": [
{
"provider": "github"
}
],
"win": {}
},
"main": ".eslintrc.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
}

Resources