node.js soap sample client fails to run - node.js

node client_soap.js
node.js:249
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module './http'
at Function._resolveFilename (module.js:333:15)
at Function._load (module.js:280:25)
at Module.require (module.js:357:17)
at require (module.js:373:17)
at Object.<anonymous> (/home/a1/mysourc3e/client_soap.js:6:12)
at Module._compile (module.js:444:26)
at Object..js (module.js:462:10)
at Module.load (module.js:351:32)
at Function._load (module.js:309:12)
at module.js:482:10
npm list
/home/a1/mysourc3e
└─┬ soap#0.1.3
├── node-expat#1.5.0
└── request#2.2.6
I'm trying to run a sample code for node.js with soap.
I can't get https://github.com/milewise/node-soap/blob/master/lib/client.js to work.
Where do I get the module from?

Use require('http') instead of require('./http').
The HTTP module is built in to node, so you shouldn't tell the loader to look for it in the current directory (as the "./" prefix does).

Related

ERR_PACKAGE_PATH_NOT_EXPORTED : Package subpath './dist/pako.es5.js' is not defined by "exports"

I have an issue with the deployment of a node app to production.
When I try to execute with Node a script I get the following error:
internal/modules/cjs/loader.js:498
throw new ERR_PACKAGE_PATH_NOT_EXPORTED(basePath, mappingKey);
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/pako.es5.js' is not defined by "exports" in /opt/iul/sat_web_lfr/node_modules/pizzip/node_modules/pako/package.json
at applyExports (internal/modules/cjs/loader.js:498:9)
at resolveExports (internal/modules/cjs/loader.js:514:23)
at Function.Module._findPath (internal/modules/cjs/loader.js:642:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1017:27)
at Function.Module._load (internal/modules/cjs/loader.js:899:27)
at Module.require (internal/modules/cjs/loader.js:1090:19)
at require (internal/modules/cjs/helpers.js:75:18)
at Object.<anonymous> (/opt/iul/sat_web_lfr/node_modules/pizzip/js/flate.js:5:12)
at Module._compile (internal/modules/cjs/loader.js:1201:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
at Module.load (internal/modules/cjs/loader.js:1050:32)
at Function.Module._load (internal/modules/cjs/loader.js:938:14)
at Module.require (internal/modules/cjs/loader.js:1090:19)
at require (internal/modules/cjs/helpers.js:75:18)
at Object.<anonymous> (/opt/iul/sat_web_lfr/node_modules/pizzip/js/compressions.js:14:19)
at Module._compile (internal/modules/cjs/loader.js:1201:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
at Module.load (internal/modules/cjs/loader.js:1050:32)
at Function.Module._load (internal/modules/cjs/loader.js:938:14)
at Module.require (internal/modules/cjs/loader.js:1090:19)
at require (internal/modules/cjs/helpers.js:75:18)
at Object.<anonymous> (/opt/iul/sat_web_lfr/node_modules/pizzip/js/utils.js:7:20) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
However when I execute this script on the testing server works fine.
We even copy and paste the node modules folder from the testing server to the production server but the error is the same.
I think is an error in some external package but I don't understand how the same configuration can have this kind of error depending on the system.
I've tried to update npm from 6.14.5 to 7.23.0 but the error persists.
Both testing and production server uses the same version of Node, 14.X
The only possibility remaining is that I'm using a different NODE_ENV variable between the 2 servers but looking at the error message it's seems unlikely.
Thanks in advance.

Cannot find module 'install-npm-version'

I'm developing this project with TypeScript: https://github.com/scott-lin/install-npm-version
When trying to consume the package within another project, I'm getting Cannot find module 'install-npm-version' error.
Repro Steps
npm install install-npm-version#1.0.2
Create repro.js file with const inv = require('install-npm-version'); as the content
Invoke the repro with node .\repro.js
Error
> node .\repro.js
module.js:545
throw err;
^
Error: Cannot find module 'install-npm-version'
at Function.Module._resolveFilename (module.js:543:15)
at Function.Module._load (module.js:470:25)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\scottlin.REDMOND\Desktop\test\repro.js:1:75)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
PS C:\Users\scottlin.REDMOND\Desktop\test>
The main property in the package.json file is used to find the module when using as an in-code Node module. Yours starts with a slash, implying the root directory. This is incorrect, which is why your code is failing.
To fix:
Change
"main": "/lib/Install.js",
to
"main": "lib/Install.js",

Custom dependency require Electron

With the package.json, it's possible to do something like this
"dependencies": {
"WindowManager": "./lib/WindowManager"
},
But when trying to do this in Electron, it gives me this error:
App threw an error during load
Error: Cannot find module 'WindowManager'
at Module._resolveFilename (module.js:470:15)
at Function.Module._resolveFilename (.../desktop/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (.../desktop/lib/init.js:15:35)
at Object.<anonymous> (.../desktop/lib/init.js:22:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
Is it because of Electron, or am I doing something wrong?
./lib/WindowManager is a folder with a package.json in it with a main pointing to the WindowManager.js, so that should work.
The case you try to do normally works, make sure that the dependency "WindowManager" has been properly copied by the build tools to either:
.../desktop/node_modules/electron/dist/Electron.app/Contents/Resources/app.asar/node_modules
or
.../desktop/node_modules/electron/dist/Electron.app/Contents/Resources/node_modules
If WindowManager does not exist in the disted node_modules there is something wrong with your build process, hard to be more precise than that.

Cannot find module 'now' - nowjs and nodejs

I installed nodejs in my home folder (/home/myname/). No problems so far.
Then I installed nowjs and there was one warning:
Checking for node path: not found
Now when I try this example: http://nowjs.com/doc/example I get the error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^ Error: Cannot find module 'now'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object.<anonymous> (/var/www/www.mydomain.de/htdocs/helloworld_server.js:7:13)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)
Something with the paths is wrong I guess...anyone knows how to fix this?
Thanks
try this before :
npm config set global true && \
echo 'export NODE_PATH="'$(npm root -g)'"' >> ~/.bashrc && \
. ~/.bashrc

where to find pattern module

I want to try this module https://github.com/creationix/nstore fore simple storage .
But when i run this code :
// Load the library
var nStore = require('nstore');
// Create a store
var users = nStore.new('data/users.db', function () {
// It's loaded now
});
It gives me this error .
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'pattern'
at Function._resolveFilename (module.js:326:11)
at Function._load (module.js:271:25)
at require (module.js:355:19)
at Object.<anonymous> (/var/www/rahulutils/node_modules/nstore/nstore.js:4:15)
at Module._compile (module.js:411:26)
at Object..js (module.js:417:10)
at Module.load (module.js:343:31)
at Function._load (module.js:302:12)
at require (module.js:355:19)
at Object.<anonymous> (/var/www/rahulutils/testnstore.js:2:14)
where can i find this pattern module.
OR
any other simple key value database i can use pls suggest.
nstore usess 'pattern' package from NPM.
look at "dependencies":
https://github.com/creationix/nstore/blob/master/package.json
It should install with nstore (if you used npm install nstore)
If you checkout project from github you have to do:
npm install pattern
npm install step
and that's it.

Resources