In Nodejs Package.json i have the below commands for 32bit Windows app:
"package-win": "electron-packager . Test -App --overwrite --asar=true --platform=win32 --arch=ia32 --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Test App\"",
but i want the same for 64bit architecture.
Just replace --arch=ia32 to --arch=x64.
"platform" stays "win32", it's all right.
Related
I have to make a pdf out of some html pages in a containerized lambda. For this purpose I am trying to use pdfkit and wkhtmltopdf. I am not able to use it an d receiving the error as shown in picture-
Error text-
No wkhtmltopdf executable found: "./wkhtmltopdf"
If this file exists please check that this process can read it or you can pass path to it manually in method call, check README. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf
My lambda code:-
import pdfkit as pdf
def lambda_function:
config = pdf.configuration(wkhtmltopdf='./wkhtmltopdf')
pdf.from_file(
filelist_new,
output_filename,
options={
'margin-top': '0.2in',
'margin-right': '0.2in',
'margin-bottom': '0.4in',
'margin-left': '0.2in',
'orientation': 'Landscape',
'page-size': 'A4',
'encoding': 'UTF-8',
'footer-line': '',
'footer-spacing': 1,
'footer-font-name': 'Times,serif',
'footer-font-size': '10'
},
configuration=config,
)
My docker file-
FROM umihico/aws-lambda-selenium-python:latest
RUN pip install pdfkit
RUN pip install boto3
RUN pip install wkhtmltopdf --target "./"
COPY lambda_function.py ./
CMD [ "lambda_function.lambda_handler" ]
and this is when I tried to find wkhtmlpdf by running the docker container:-
Update: Issue got solved
This worked for my case.
DockerFile:
FROM umihico/aws-lambda-selenium-python:latest
RUN pip install pdfkit --target ${LAMBDA_TASK_ROOT}
RUN pip install boto3
RUN yum install -y openssl xorg-x11-fonts-75dpi xorg-x11-fonts-Type1
RUN curl "https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.amazonlinux2.x86_64.rpm" -L -o wkhtmltox-0.12.6-1.amazonlinux2.x86_64.rpm
RUN rpm -i wkhtmltox-0.12.6-1.amazonlinux2.x86_64.rpm
COPY lambda_function.py ./
CMD [ "lambda_function.lambda_handler" ]
Lambda code:
import pdfkit as pdf
def lambda_function:
config = pdf.configuration(wkhtmltopdf='/usr/local/bin/wkhtmltopdf')
pdf.from_file(
filelist_new,
output_filename,
options={
'enable-local-file-access': '',
'margin-top': '0.2in',
'margin-right': '0.2in',
'margin-bottom': '0.4in',
'margin-left': '0.2in',
'orientation': 'Landscape',
'page-size': 'A4',
'encoding': 'UTF-8',
'footer-line': '',
'footer-spacing': 1,
'footer-font-name': 'Times,serif',
'footer-font-size': '10'
},
configuration=config,
)
Links which I referred- https://micropyramid.com/blog/how-to-create-pdf-files-in-python-using-pdfkit/ , How to install wkhtmltopdf on a linux based (shared hosting) web server
I am experiencing some unusual behavior when I build my .NET 6.0 API. Below is the error I'm receiving.
Actual Error:
error NU3037: Package
'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0'
from source 'https://api.nuget.org/v3/index.json': The repository
primary signature validity period has expired. [C:\code\MyApi.sln]
error NU3028: Package
'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0'
from source 'https://api.nuget.org/v3/index.json': The repository
primary signature's timestamping certificate is not trusted by the
trust provider. [C:\code\MyApi.sln]
Complete log/error from build:
MSBuild version 17.4.0+18d5aef85 for .NET
Determining projects to restore...
Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json':
Signature type: Repository
Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json': Subject Name: CN=NuGet.org Repository by Microsoft, O=NuGet.org Repository by Microsoft, L=Redmond, S=Washington, C=US
Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json': SHA256 hash: 0E5F38F57DC1BCC806D8494F4F90FBCEDD988B46760709CBEEC6F4219AA6157D
Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json': Valid from: 4/9/2018 7:00:00 PM to 4/14/2021 7:00:00 AM
C:\code\MyApi\MyApi.csproj : error NU3037: Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json': The repository primary signature validity period has expired. [C:\code\MyApi.sln]
C:\code\MyApi\MyApi.csproj : error NU3028: Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json': The repository primary signature's timestamping certificate is not trusted by the trust provider. [C:\code\MyApi.sln]
Failed to restore C:\code\MyApi\MyApi.csproj (in 3.35 sec).
Anyone know the cause of this? And how do you fix it?
Note: This is happening at random; sometimes, but not usually, rerunning the build fixes it. The build has been working without issue for months, and I recently started to see this error.
I am running dotnet publish command inside a Docker, if it matters.
DockerFile:
# escape=`
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2016
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Node/npm Install
RUN write-host "*********** Install node,npm"
ENV NODE_VERSION 16.13.0
RUN Invoke-WebRequest -OutFile nodejs.zip -UseBasicParsing $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION); `
Expand-Archive nodejs.zip -DestinationPath C:\; `
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'
RUN SETX PATH C:\nodejs
RUN npm config set registry https://registry.npmjs.org/
# Install webpack
RUN write-host "*********** Install webpack"
RUN npm install webpack#4.1.1 -g
RUN npm install webpack-cli#3.2.1 -g
# Add the shared for version build
RUN write-host "*********** Copy shared directory"
COPY shared \shared
# Verify installation
RUN dotnet --version
RUN dotnet --info
RUN node -v
RUN npm -v
RUN webpack -v
#RUN dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
RUN dotnet nuget list source
And the actual command in TeamCity to compile the code. This is the where it fails:
dotnet publish MyApi.sln -o C:\stage
I am trying to create new Ruby on Rails project with:
rails new project -v 7.0.4 --css=sass --javascript=esbuild --database=mysql
And I get:
...
Add build script
run npm set-script build "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets" from "."
Unknown command: "set-script"
Did you mean this?
npm run-script # Run arbitrary package scripts
...
npm version:
% npm -v
9.1.2
% which npm
/Users/foo/.nvm/versions/node/v19.1.0/bin/npm
Interesting is that nvm help doesn't even show set-script in "All commands" list.
I am on Mac M2, not sure if relevant.
I didn't find anything on google.
set-script has been deprecated as per documentation
The below should work
npm pkg set scripts.build="esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets"
The "cdk" command is not found after installing with "pip install --upgrade aws-cdk.core" (per the docs).
The package successfully installs because it is found in the "site-packages" directory.
tennis.smith at C02TM089GY6N in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
$ ls
README.txt cattr/ docopt-0.6.2.dist-info/ pip/ requests-2.22.0.dist-info/ typing_extensions.py
__pycache__/ cattrs-0.9.0.dist-info/ docopt.py pip-19.3.dist-info/ setuptools/ urllib3/
attr/ certifi/ easy_install.py pkg_resources/ setuptools-41.2.0.dist-info/ urllib3-1.25.6.dist-info/
attrs-19.3.0.dist-info/ certifi-2019.9.11.dist-info/ idna/ publication-0.0.3.dist-info/ six-1.12.0.dist-info/ wheel/
aws_cdk/ chardet/ idna-2.8.dist-info/ publication.py six.py wheel-0.33.6.dist-info/
aws_cdk.core-1.13.1.dist-info/ chardet-3.0.4.dist-info/ jsii/ python_dateutil-2.8.0.dist-info/ tests/ yarg/
aws_cdk.cx_api-1.13.1.dist-info/ dateutil/ jsii-0.19.0.dist-info/ requests/ typing_extensions-3.7.4.dist-info/ yarg-0.1.9.dist-info/
Any ideas why it isn't being detected?
To install the CDK CLI run npm install -g aws-cdk.
Electron-packager generates folder my-app-win32-x64 but I want this file to be only my-app. I want rest to be removed. I understand electron packager generates .zip file. When this is unzipped it retains the same name.
I tried editing index.js under electron-packager. I am not able to understand this .zip file is generated. So that I can edit the name in which elctron-packager generates this file.
Directory structure:
my-app
/scripts
...
...
/win64
/my-app-win32-x64 //this directory name must be just my-app
my-app.exe
/app
Build script:
"build": "electron-packager --out winx64 --overwrite --platform win32 --appname my-app . --icon=./my_logo.ico --executable-name my-app"
I don't understand how this relates to any ZIP file at all. electron-packager creates a directory structure with an executable, folders, etc., but no ZIP file.
Electron-packager creates a directory {out}/{appname}-win32-x64 where {out} and {appname} are the given command line parameters.
Since you want this output directory to have a different name, you could simply rename it after it's created.
Linux/Mac:
"build": "electron-packager ... && mv win64/my-app-win32-x64 win64/my-app"
Windows:
"build": "electron-packager ... && ren win64\my-app-win32-x64 win64\my-app"
The && runs the second command only if the first one completes successfully (non-zero exit code).