Static Website Flet deployment - No module error - web

I can run my Flet application in the IDE and it renders in a browser, everything works.
However, once built as a static website it produces the /dist folder as expected. I have created a local website in IIS (on the same machine) and pointed at this folder.
When I post the url it tries to start my application but is does not load. F12 to view developer options shows the error ...
ModuleNotFoundError: No module named 'selenium'
The module is installed.
Am I missing a path? Version of py is 3.7.2
I have tried to set paths but to no avail

Related

Can't access dependencies in node modules folder

In the project folder, I'm using the pnpm install command on a linux enviornment to download the node module dependencies, but for some reason none of the files either are accessible or downloaded correctly. Visual Studio Code can't access the individual folders and when checking the files on the drive, all the relevant files show as having 0KB and give a pop-up saying that "The file can't be accessed by the system" when I try to access them manually. However, despite not being able to edit the files on the development level, I'm able to run the web application perfectly fine.
I checked the security settings for the files and I do have the relevant permissions. I double-checked the Node.js version on my system and it is the proper version. In all of the files for the project, whenever use of a dependency comes up VS Code gives an an error such as "Cannot find module '#remix-run/node' or its corresponding type declarations.ts(2307)."enter image description here

Not allowed to load local resource -error on chrome, Angular app is not running after production build

I am having a problem with the deployment of an angular app. It does not occur on another machine if deployed. My app is not running and it shows the following error on Chrome:
Not allowed to load local resource
and in Mozilla:
'src' attribute of element is not a valid URI
The thing is, it is working completely fine if deployed from other machines. So I am guessing the issue is with the versions of node or typescript or ng or whatsoever. I am new to server deployment and this kind of issue is new to me.
I am using following command to generate the deployment folder:
ng build --prod --base-href /candidate/
Following is my version details:
Node version: v10.16.3
Application typescirpt version: Version 2.9.2
Globally installed typescript version on the machine: Version 3.6.3
I deleted node modules and package-lock.json file and run npm install before production build. I got no error and was successfully able to generate dist folder.
The deployment folder works perfectly if it is deployed from machines which have upgraded or downgraded node version installed.
I have found many suggestions regarding the error shown on the browser, tried upgrading the node global versions but there is no way around. I am quite unsure about what I am missing here. Any kind of heads up would be great in this situation.
After digging into deep I found out that the problem is not with the version rather with the base URL it is generating in index.html file after build.
This issue occurs when using git-bash on Windows.
The git-bash sees the last argument of the command- ng build --prod --base-href /candidate/ as a path relative to its binary folder and prepends the argument with that (it converts the "seems-to-be" relative path into an absolute path).
So, I used PowerShell instead of Git-Bash and the issue was gone. The base-href parameter is handled fine there.
To resolve the issue with git-bash go through this link, which actually helped me to resolved my particular issue.
You should control base tag in index.html in dist folder.
<base href="/">

ERROR in : Cannot determine the module for class SomeComponent in /path to that component.ts! Add SomeComponent to the NgModule to fix it

I have angular 6 / node js system which is already in live. So now i need to move the latest changes to live server and before that to dev server. Both are same environment that is Linux Server (RHEL7.6) and am in working windows.
So am getting this error when am doing ng build --prod in dev server but ng serve will work and ng build will work, and am not getting this error in my local machine which is windows. I googled and found some case sensitive can be a reason for this but i double checked and am 100% sure that is not a reason here. And also i refereed this page Cannot determine the module for class X in X.ts! Add X to the NgModule to fix it error in ionic2 but that also does not helping me. The issue is happening only for the components that already exits, i just changed location of that components and one components name. And i moved all the changes through winSCP to dev server.
Any help is appreciated.
This issue was because when i changed location of a component in local and moved whole folder to dev server using winscp, in dev the component will exits in new location and also it will be there in old location as it will not be deleting files when you move folder like that using winscp. So there will be component with same name in different location and that was the reason for this issue
Note :- There was no import code for this duplicate entry from old
location in my app.module.ts (Angular Code where we import components) file still this issue occurred i don't know how and why.
Deleted files from old location and tried ng build --prod and it worked.

Package web static site to exe nodejs

I have static site with some file below:
index.html
bundle.js
images/some file
some file font, and svg
Problem: I want to build an exe file to serve above file which should run on window.
When install exe file, program will run static site and other component can connect
Please suggest me a for me tool
You may build a node application using express.js web server, then you can compile the code and assets into an exe file using the the pkg module
Using the pkg module you can bundle your node application to run on windows, mac or linux.
To package your statics files with pkg you need to add assets directory to the package.json as mentioned in the document
"pkg": {
"assets": "your-assets-dir/**/*"
}
Please follow these links,
pkg module
expressjs
If you want to make an installer for windows you may use, inno script studio
You can use Electron. It can serve your static site in a chrome window. But as a Desktop app. You can build this for cross platform and you can also make installer file.

How can i download file inside app folder ?[ after packaging ]

This is my current folder structurebefore packaging
WRM_80.. is my downloaded folder.
I have these two lines of code inside index.js to download and show html in my electron window
fs.createReadStream('./Report.zip').pipe(unzip.Extract({ path: './'+folderName }));
LoginWindow.loadURL(`file://${__dirname}./`+folderName+`/t01s01q01.html`);
in development mode its working fine, file downloaded inside the same folder where my index.js exists. But after packaging the app file is downloading outside app folder. Packaged folder structure is given below WRM_80.. is my downloaded folder.
after packaging
That's why I can not load that downloaded file into window. How can I download file inside app folder? If that is not possible, how can I load external file from resources\app location ?
By referencing the directory as ./folder_name you are essentially telling the application to download to the working directory. In this case, the working directory is the folder that the program is contained in. While developing and using the electron command, the working directory is the root of your application. However once installed and running as a .exe, the working directory changes to the location of the executable.
To solve this problem, do not use the current working directory. Instead use the user / application data folder to store this information. It is not only a consistent location across development and deployment, but it is also the semantically correct place to store application data.
In Electron you can get the path to the application data folder for your app with:
const {app} = require('electron');
app.getPath('userData')
So your code should look something like this:
var userData = app.getPath('userData');
fs.createReadStream(`${userData}/Report.zip`).pipe(unzip.Extract({ path: `${userData}/${folderName}` }));
LoginWindow.loadURL(`file://${userData}/${folderName}/t01s01q01.html`);

Resources