Ionic and ssh2: Error: process.binding not supported - javascript

I am trying to learn Ionic and I am attempting to create a simple application that uses SSH2 to establish an ssh connection between application and server. The following are the steps that I did in order to get the problem:
Steps to reproduce:
Create application: ionic start app_name tabs
cd to app_name directory
npm install --save ssh2
open project, go to any page (e.g. home.ts) and import ssh2 from 'ssh2';
Inside constructor type: console.dir(ssh2); Run ionic serve
Get Error: Cannot find module: dns and solved by adding dns: 'empty' to /config/webpack.config.js
Run application again and get Error: process.binding is not supported
I am using the following:
Ionic Framework: 3.9.2
Ionic App Scripts: 3.1.10
Angular Core: 5.2.11
Angular Compiler CLI: 5.2.11
Node: 8.11.2
OS Platform: Windows 10

Thank you Suraj! It seems like ssh2 is written only for node.js
Can you use the node package ssh2 in a browser?

Related

Laravel Mix HMR Server Does Not Launch

Laravel Mix Version: 6.0.43
Node Version (node -v): 16.13.1
NPM Version (npm -v): 8.1.2
OS: Windows 10 21h2
Description:
THIS IS HAPPENING ON A FRESH NEW INSTALL OF LARAVEL AND MY OTHER PROJECTS
Running npm run hot changes the script tag sources to http://localhost:8080/*/*.* from http://localhost/*/*.* HOWEVER I always get net::ERR_EMPTY_RESPONSE from localhost:8080. The HMR server doesn't launch at all. The terminal output of the command also have no mention of spinning up a new web server.
PS C:\Users\Eric Wang\Documents\GitHub\test-laravel-mix> npm run hot
● Mix █████████████████████████ emitting (95%)
emit
● Mix █████████████████████████ done (99%) plugins
WebpackBar:done
✔ Mix
Compiled successfully in 5.51s
Laravel Mix v6.0.43
✔ Compiled Successfully in 5336ms
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────┐├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────┤│ css/app.css │ 47.6 KiB │└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────┘webpack compiled successfully
Here's a picture of the browser failing to fetch the bundle files
Steps To Reproduce:
I am running Docker 4.5.1 using legacy Hyper-V.
I containerized Laravel and PHP BUT not the frontend and JS. I am running Laravel Mix on my main system.
Clone the fresh installation of Laravel from https://github.com/ericwang401/test-laravel-mix
Clone Laradock in the project folder using git clone https://github.com/laradock/laradock.git
CD to the Laradock folder and make .env file with cp .env.example .env
Inside .env file set PHP_VERSION to PHP_VERSION=8.0 AND DO NOT EDIT MYSQL SETTINGS
Now edit the Laravel environment file
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
Start up the Laravel app in Laradock folder using docker-compose up -d nginx mysql
Enter into bash mode in the Docker container docker-compose exec workspace bash
Install Composer dependencies BUT NOT NPM DEPENDENCIES YET composer i
Now exit out of the Docker container CNTRL + D
Install NPM dependencies in project root ON YOUR MAIN SYSTEM npm i
Run on your main system npm run hot
Now go to http://localhost and IT SHOULD be a white screen
Check console logs and it should give net::ERR_EMPTY_RESPONSE when it tries to fetch the bundle files
REMEMBER: the backend is running inside Docker
The frontend (Laravel Mix) is running on the host system
This issue is happening on a FRESH project installation of Laravel 9 + Jetstream AND it's also happening on my other older projects like https://github.com/StratumPanel/Stratum-Panel
The HMR server is simply not launching.
I found out the issue. The problem was that the default port, 8080, Laravel Mix HMR was using couldn't be binded to. Webpack Dev Server doesn't respond with a message of failing to bind to a port. To confirm this issue, I replicated the environment on my friend's PC and it too couldn't bind to port 8080, but this time it reported an error that the dev server couldn't bind to port 8080.
I fixed this issue by specifying
mix.options({
hmrOptions: {
host: 'localhost',
port: 4206
}
});
And it works! On both my friend's pc and my pc.
I used the exact same reproduction instructions on my friend's PC.
I spent way too long investigating this issue 😭

HTTP 404 Error when changing the angular build folder name in Apache Tomcat

Currently I'm working on an angular project which is hosted in "AWS Ec2". The build output is "www". Usually we change the name into the name we're using for ages. It's working fine. But, When I tried to change the build folder name to any other names. The Tomcat throws a "The origin server did not find a current representation for the target resource or is not willing to disclose that one exists." error. We also have other projects which were built by "ionic s" command. Those projects working fine even after changing name to any names we desire..
Bu, the project I'm talking about was buit by "ng build --prod"
These are the specs..
I tried changing the build output path in "angular.json" file
"outputPath": "build/<somebuild>"
Tomcat Version : 8.5.35
Angular CLI: 7.3.8
Node: 14.13.1
OS: win32 x64
Angular: 7.2.13
#angular-devkit/architect 0.13.8
#schematics/angular 7.3.8
#schematics/update 0.13.8
rxjs 6.3.3
typescript 3.2.4
webpack 4.29.0

I get a "Failed to load resource" for Cordova error when trying to run the blank ionic starter app

I'm trying to get the blank Ionic starter app running (1.2.4); and I get this error after installing Ionic and trying to run their demo app:
Console:
[Error] Failed to load resource: The requested URL was not found on
this server. (cordova.js, line 0)
How do I resolve the 'failed to load resource' error for cordova?
According to the Ionic Framework Website, you need to do the following steps:
Install Node.js 4 (Not Node 5):
Using Homebrew:
brew tap homebrew/versions
brew install node4-lts
when NPM is installed, run this:
npm install -g cordova ionic
That installs cordova and Ionic globally.
Once you do that, your ionic start myApp starter should build and install the necessary items to have a blank Ionic app.
I can't give you instructions on how to install it other ways (there are so many ways to install it depending on your OS.

Installing node.js for angular - connect.static and karma

I'm trying to install a simple node webserver following the example in Pro AngularJS from apress.
I've installed node.js and the connect and karma modules.
I do get a warning when I installed karma via: "npm install -g karma" that says "optional dep failed, continuing" but then seems to install correctly.
I created a server.js based on the example:
var connect = require('connect');
connect.createServer(
connect.static("../angularjs")
).listen(5000);
when I run it I get TypeError:Undefined is not a function pointing to connect.static.
Apparently in the latest build of connect the static middleware has been moved to it's own package.
nodejs connect cannot find static

Titanium Module (Android) - "Requested module not found"

I'm creating a module and adding it to an application
application structure:
module structure:
access code module:
var module = require('ar.com.module');
$.label.text = module.example();
error:
steps to run application:
include module in app
clean and build app
run to device
Titanium SDK version: 3.2.0.GA
NDK Android: r8
Android plataform (module): android-10
solution to this problem?
Solution:
to run the module in a device must be configured deploy-type = "test" in tiapp.xml and install gperf add to Path.

Categories