baalexander / node-xmlrpc

A pure JavaScript XML-RPC client and server for Node.js.
MIT License
298 stars 149 forks source link

XMLRPC not resolve https/https #151

Closed ramkrishna70 closed 3 years ago

ramkrishna70 commented 5 years ago

I installed xmlrpc package in angular project to call the api, but while using xmlrpc import, it raised error.

[ng] WARNING in ./node_modules/xmlrpc/node_modules/sax/lib/sax.js
[ng] Module not found: Error: Can't resolve 'stream' in '/Users/Abhijit/projects/invincixWaveCA35/node_modules/xmlrpc/node_modules/sax/lib'
[ng] 
[ng] ERROR in ./node_modules/xmlrpc/lib/client.js
[ng] Module not found: Error: Can't resolve 'http' in '/Users/Abhijit/projects/invincixWaveCA35/node_modules/xmlrpc/lib'
[ng] ERROR in ./node_modules/xmlrpc/lib/server.js
[ng] Module not found: Error: Can't resolve 'http' in '/Users/Abhijit/projects/invincixWaveCA35/node_modules/xmlrpc/lib'
[ng] ERROR in ./node_modules/xmlrpc/lib/client.js
[ng] Module not found: Error: Can't resolve 'https' in '/Users/Abhijit/projects/invincixWaveCA35/node_modules/xmlrpc/lib'
[ng] ERROR in ./node_modules/xmlrpc/lib/server.js
[ng] Module not found: Error: Can't resolve 'https' in '/Users/Abhijit/projects/invincixWaveCA35/node_modules/xmlrpc/lib'

My angular setup:

    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 7.3.6
Node: 10.15.3
OS: darwin x64
Angular: 7.2.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.6
@angular-devkit/build-angular     0.13.6
@angular-devkit/build-optimizer   0.13.6
@angular-devkit/build-webpack     0.13.6
@angular-devkit/core              7.3.6
@angular-devkit/schematics        7.3.6
@angular/cli                      7.3.6
@ngtools/webpack                  7.3.6
@schematics/angular               7.3.6
@schematics/update                0.13.6
rxjs                              6.4.0
typescript                        3.1.6
webpack                           4.29.0

setting.ts:

import xmlrpc from 'xmlrpc';
export class Settings{
static common_api: any = xmlrpc.createSecureClient({ host: Settings.server_domain, port: Settings.server_port,
      path: '/xmlrpc/2/common'});
}

Please suggest me, if I have missed any thing.

kasback commented 5 years ago

I have the same issue. the client.js and server.js files both require the http and https scripts but none are found in the plugin node-modules directory .

ibuioli commented 4 years ago

This is and error with angualr-devkit. You need change this file: node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js

Find the line node: false and replace it with node: {http:true,https:true,url:true}

Its a few dirty, but works. The best choice is make and script.

tom10271 commented 3 years ago

@ibuioli Modifying files in node_modules? This is not a solution at all

ramkrishna70 commented 3 years ago

@ibuioli Modifying files in node_modules? This is not a solution at all

You can use this. Just create a service class in your project and copy code of index.ts file to your new server some named as "xmlrpc"

https://github.com/ramkrishna70/ionxmlrpc

This will work like charm, hope this will resolve your issue.