Getting 'Could not find configuration for port' Error starting N|Solid Proxy - node.js

I'm getting the following error trying to start the N|Solid proxy
Daves-MBP:proxy-3.2.2 davblak$ npm start
> nsolid-proxy#3.2.2 start /Users/davblak/proxy-3.2.2
> nsolid proxy.js
/Users/davblak/proxy-3.2.2/proxy.js:9
throw new Error("Could not find configuration for port")
Error: Could not find configuration for port
at Object.<anonymous> (/Users/davblak/proxy-3.2.2/proxy.js:9:9)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:475:10)
at startup (node.js:149:18)
at node.js:985:3
I do have the etcd service running - any thoughts?

On your proxy-3.2.2 folder you need to have a .nsolid-proxyrc file with configuration options for your proxy, can you confirm if the file is in there?, if not this file should look like:
{
"registry": "localhost:4001",
"port": 9000,
"denied": [],
"broadcast_approved": [
"ping",
"process_stats",
"system_stats",
"system_info",
"info",
"versions",
"startup_times"
]
}

Ah, that is the issue. I think I realized how this happened. After downloading the files I went into the directory and copy/pasted the files via Finder. As Finder doesn't by default show . files I didn't copy the .nsolid-proxyrc file.
I blew away my directories and tried again; this time I copied the entire directory at the folder level. Using ls -al I now see the .nsolid-proxyrc file in there and the proxy works. Thanks for all the help!

Related

Unable to --watch directory with node-dev

I am trying to watch only specific directories while starting node-dev because of the issue with multiple watches that causes;
Error: watch /usr/src/app/node_modules/common-tags/lib/stripIndent/stripIndent.js ENOSPC
I tried passing the watch flag but, the process is not able to find the module;
node-dev --watch api app.js
It throws the below error:
Error: Cannot find module 'api' from '/usr/src/app'
at resolveSync (/usr/src/app/node_modules/resolve/lib/sync.js:89:15)
at module.exports (/usr/src/app/node_modules/node-dev/lib/resolve-main.js:4:10)
at getConfig (/usr/src/app/node_modules/node-dev/lib/cfg.js:30:16)
at module.exports (/usr/src/app/node_modules/node-dev/lib/cli.js:46:14)
at Object.<anonymous> (/usr/src/app/node_modules/node-dev/bin/node-dev:11:5)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
The api directory is present in /usr/src/app. I tried using the same watch flag with nodemon and it seems to work but it has its own set of issues and crashes when a file change occurs.
I tried putting the configuration in .node-dev.json, but there has been no impact.
{
"watch": ["api"],
"ignore": [
"*.test.js",
"assets/*",
"coverage/*",
"docs/*",
"email_templates/*",
"kubernetes/*",
"logs/*",
"node_modules/*",
"queue/*",
"script/*",
"shared/*",
"tasks/*",
"test/*",
"tests/*",
"uitests/*",
"views/*"
]
}
Please note that I cannot modify fs.inotify.max_user_watches as the VM is shared and I don't have permission to run system commands.
Any help would be highly appreciated.

how can i fix this error that nodemon keep on showing

i following an express.js tutorial andd after some code and functionalities with api requests i followed exactly how he changed the code that handles these requests into a seperate js file in another folder just to clean up the code but after i did that this error showed up
i tried changing the file name , i tried removing the node-modules folder and running npm install again and i tried installing the module with the issue
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '/routes/api/members'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Users\Get_Rico\Desktop\crashcoursse\index.js:11:25)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
[nodemon] app crashed - waiting for file changes before starting...
i expect nodemon to save the changes and work just fine with no errors just like what happened in the tutorial
It appears the error is probably coming from this line of code and it's telling you that it can't find the '/routes/api/members' module file.
And, this would not be working because you're trying to load a local module without a proper path name. If no path is specified, then it tries to load a global or built-in module. If that module is in the current directory, then you should use the correct path:
const yourModule = './routes/api/members';

Error: Cannot find module 'C:\server.js' in Node server for Meanjs

I have git cloned meanjs into a folder in D: drive as shown below and ran the command npm start to start the node server.
admin#admin-PC MINGW32 /d/Udemy Angular 1 projects/Project5/jobfinder (master)
$ npm start
> meanjs#0.5.0 start D:\Udemy Angular 1 projects\Project5\jobfinder
> gulp
[23:41:30] Using gulpfile D:\Udemy Angular 1 projects\Project5\jobfinder\gulpfile.js
....and got the below error.
Error: Cannot find module 'C:\server.js'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
[23:58:35] [nodemon] app crashed - waiting for file changes before starting...
After that, just to give it a try I copied the server.js from the current directory to C:\ and issued 'npm start' command at git bash from the same directory and the error changed to below.
Debugger listening on [::]:5858
module.js:457
throw err;
^
Error: Cannot find module './config/lib/app'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\server.js:6:11)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
[23:41:52] [nodemon] app crashed - waiting for file changes before starting...
Can anyone please help me understand why is Node looking for server.js and other resources at C:\ instead of the current directory? Is there anything very simple I am missing out (though I find it quite strange !). Btw sorry for posting the git bash errors as code since I did not have enough reputations to post more than one image link.
Cheers!
Adding my research ....
Invoking 'npm start' command in meanjs directory hits the file gulpfile.js. Looking into the file, I saw that a gulp task (nodemon) was initiated as below and the script property of the return object was set to 'server.js'.
Code from gulpfile.js.
gulp.task('nodemon', function () {
var nodeVersions = process.versions;
var debugArgument = '--debug';
switch (nodeVersions.node.substr(0, 1)) {
case '4':
case '5':
case '6':
debugArgument = '--debug';
break;
case '7':
debugArgument = '--inspect';
break;
}
console.log('nodemon task'); // checking execution of the callback
return plugins.nodemon({
script: 'server.js',
nodeArgs: [debugArgument],
ext: 'js,html',
verbose: true,
watch: _.union(defaultAssets.server.views, defaultAssets.server.allJS, defaultAssets.server.config)
});
});
The above problem was solved by deleting the Autorun string in the registry at the below path.
"HKEY_CURRENT_USER\Software\Microsoft\Command Processor".
The autorun string was set to C: and as a result Nodemon recognised C: as the root instead of the current directory in Gitbash or command prompt.

Error pointing to non-existent file when running Node.js app locally

I was just sent the files for a Node.js app (which is working without issues online) and I'm trying to set it up on my Windows machine.
I have Node server running, but I'm stuck trying to actually load the app. I can navigate to the directory with the Node command prompt, and there's an app.js (plus folders like config, components etc) in there which I've been trying to run, but I am getting the following error:
D:\my-directory\game-master>node app.js
module.js:327
throw err;
^
Error: Cannot find module 'config'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (D:\posao\aktivni projekti\smart rebellion\game-master
\app.js:7:10)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
The thing is, there is no file titled module.js in the directory. I presume it's a built in Node.js file, but then how do I troubleshoot this?
My best reading of the error is that there should be a config.js file somewhere, but that doesn't make sense because these same exact files work with no hickups on a remote server.
If you want to require('./config'), where config is a directory, the file ./config/index.js should exist.
You can't require('config') however, because node.js will try to find it in node_modules.
Check out node.js modules documentation where the require algorithm is well explained.

Node JS app on OpenShift gives error 503

So I created a NodeJS app for a college project which monitors page loading speed. In order to record said speed I need people to go to the web application, go to a certain page and hit a button a couple of times.
So I looked up a way to host this app, free of charge, and came up with OpenShift.
After figuring out how it all worked I managed to setup an OpenShift git-repository and I am able to push my changes to the server.
However upon visiting my page I kept getting error 503. Initially I thought it was a node modules error so I found npm shrinkwrap which solved npm version issues. The error, is still around.
When I run the app locally, I get no errors whatsoever and all modules are installed correctly. They are also in a package.json file (I used npm install --save for all my modules, so no manual editing was performed).
These are the first couple of lines from using the tail-command and whopping the result into a text file.
==> app-root/logs/nodejs.log <==
at Connection.connect (/var/lib/openshift/550db5624382ecf8f400000f/app>root/runtime/repo/node_modules/mysql/lib/Connection.js:109:18)
at Object.<anonymous> (/var/lib/openshift/550db5624382ecf8f400000f/approot/runtime/repo/server.js:28:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
DEBUG: Program node server.js exited with code 8
DEBUG: Starting child process with 'node server.js'
I also found this:
==> app-root/logs/nodejs.log <==
Error: connect ECONNREFUSED
at errnoException (net.js:901:11)
at Object.afterConnect [as oncomplete] (net.js:892:19)
--------------------
at Protocol._enqueue (/var/lib/openshift/550db5624382ecf8f400000f/app-root/runtime/repo/node_modules/mysql/lib/protocol/Protocol.js:135:48)
at Protocol.handshake (/var/lib/openshift/550db5624382ecf8f400000f/app-root/runtime/repo/node_modules/mysql/lib/protocol/Protocol.js:52:41)
at Connection.connect (/var/lib/openshift/550db5624382ecf8f400000f/app-root/runtime/repo/node_modules/mysql/lib/Connection.js:109:18)
at Object.<anonymous> (/var/lib/openshift/550db5624382ecf8f400000f/app-root/runtime/repo/server.js:28:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
DEBUG: Program node server.js exited with code 8
Any idea's?
Mine did the same when I first pushed to OpenShift. I think I had to review some references and make some slight changes. My log on OpenShift indicated that such-and-such file couldn't be found. Yours might, too, if you review the entire thing.
For example, this is the "after" version of something I edited:
self.app.set('views', path.join(__dirname, 'views'));
I might have had just this before:
self.app.set('views', '/views');
Hope that helps.
Well... you've got...
Error: connect ECONNREFUSED
...which suggests that Express couldn't connect to the database. Maybe you've got dev versus prod credentials going on and the code's trying to use the local credentials, the local database name, the local username, the local server, etc.
I'm using MongoDB (no credentials locally) and have created a /db.js file to store all that. And then my /server.js selects which variable:
if (typeof process.env.OPENSHIFT_NODEJS_IP === "undefined") { mongoose.connect(dbConfig.devurl); } else { mongoose.connect(dbConfig.produrl); }
Note the two different variables after dbConfig.varname.

Resources