Nodeclipse + nodemon error - node.js

When I try to run an express app in nodeclipse, it gives me the error,
23 Jan 11:58:04 - [33m[nodemon] v1.0.13[39m
23 Jan 11:58:04 - [33m[nodemon] to restart at any time, enter rs[39m
23 Jan 11:58:04 - [33m[nodemon] watching: .[39m
23 Jan 11:58:04 - [32m[nodemon] starting node
/home/rdteam/workspace/NedvedNodeExpressTest/app.js[39m
[31m[nodemon] unable to run executable: "node"[39m
However, when I run from command line that
node /home/rdteam/workspace/NedvedNodeExpressTest/app.js
or
nodemon /home/rdteam/workspace/NedvedNodeExpressTest/app.js
both work without problem.
Pls help.
Regards
Hammer

In my case (running os x) I quick solved it setting the full path in :
/usr/local/lib/node_modules/nodemon/lib/monitor/run.js
function run(options) {
var cmd = config.command.raw;
//Added line
cmd.executable = '/usr/local/bin/node';

I was able to solve this problem by using the forever module, and configuring Nodeclipse's 'Node monitor path' to point to forever (*../npm/node_modules/forever/bin/forever*)
npm install forever
Open Eclipse -> Preferences -> Nodeclipse
Set the 'Node monitor path' to your installation of forever, and you're done.
I ran headlong into this problem whilst setting up Nodeclipse, and getting my node programs to work on Eclipse Kepler running on Mac OS X 10.8.5 (Mountain Lion)

The use case "Nodeclipse with nodemon":
Nodeclipse 0.9 Eclipse 4.2.2 Java 1.7 on win32
Configure Nodeclipse with monitor path C:\Users\weibl\AppData\Roaming\npm\node_modules\nodemon\nodemon.js
logilog.js with console.log('done');
Run As -> Node with monitor
Produced command line (seen in Nodeclipse Console):
node --harmony C:\Users\weibl\AppData\Roaming\npm\node_modules\nodemon\nodemon.js D:\Workspaces\ADT-Bundle\CountingServer\try\logilog.js
Console output
23 Jan 16:23:35 - [33m[nodemon] v0.7.10[0m
Error: ENOENT, no such file or directory 'D:\Workspaces\ADT-Bundle\CountingServer\try\undefined\nodemonCheckFsWatch1390465415226'
at Object.fs.openSync (fs.js:427:18)
at Object.watchFileChecker.check (C:\Users\weibl\AppData\Roaming\npm\node_modules\nodemon\nodemon.js:154:22)
at ready (C:\Users\weibl\AppData\Roaming\npm\node_modules\nodemon\nodemon.js:49:22)
at testAndStart (C:\Users\weibl\AppData\Roaming\npm\node_modules\nodemon\nodemon.js:71:5)
at Object.<anonymous> (C:\Users\weibl\AppData\Roaming\npm\node_modules\nodemon\nodemon.js:847:1)
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)
23 Jan 16:23:35 - [33m[nodemon] to restart at any time, enter `rs`[0m
23 Jan 16:23:35 - [32m[nodemon] watching: D:\Workspaces\ADT-Bundle\CountingServer\try[0m
23 Jan 16:23:35 - [nodemon] exception in nodemon killing node
Created issues #118 https://github.com/Nodeclipse/nodeclipse-1/issues/118
That is how issues are reported.
Thank you for letting know that you need this. Check http://www.nodeclipse.org/ on news and how to help.

If you create a nodemon.json config file in your application folder (e.g. /home/rdteam/workspace/NedvedNodeExpressTest/nodemon.json) with the following JSON it should work without having to modify the Nodemon source files.
{
"exec": "/usr/local/bin/node"
}
This work on OS X, you may need to change the path depending on where you have node installed.
Details on Nodemon config files:
https://github.com/remy/nodemon#config-files

Related

EACCESS error when running meteor on Windows 10's VSCode

I tried to deploy my project, but this error still happens. I have restarted net driver, disabled Windows Defender, changed permission on my directory, let VSCode have admin right, but this error still persists. I could not even run on CMD with admin rights. I could deploy using WSL it takes a very long time for deployment. How can I fix this?
Error: EACCES: permission denied, stat 'C:\Users\mq003\Documents\myproject\.meteor\local\dev_bundle'
at Object.statSync (fs.js:1132:3)
at statOrNull (C:\Users\mq003\AppData\Local\.meteor\packages\meteor-tool\2.8.1\mt-os.windows.x86_64\tools\cli\dev-bundle.js:94:21)
at getDevBundleDir (C:\Users\mq003\AppData\Local\.meteor\packages\meteor-tool\2.8.1\mt-os.windows.x86_64\tools\cli\dev-bundle.js:32:25)
at Object.<anonymous> (C:\Users\mq003\AppData\Local\.meteor\packages\meteor-tool\2.8.1\mt-os.windows.x86_64\tools\cli\dev-bundle.js:142:20)
at Object.<anonymous> (C:\Users\mq003\AppData\Local\.meteor\packages\meteor-tool\2.8.1\mt-os.windows.x86_64\tools\cli\dev-bundle.js:145:3)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19) {
errno: -4092,
syscall: 'stat',
code: 'EACCES',
path: 'C:\\Users\\mq003\\Documents\\myproject\\.meteor\\local\\dev_bundle'
}
I see some options:
try deploy on docker.
restart winnat following this answer
https://stackoverflow.com/a/67968597/6398044
remove other processes on your meteor port (eg using kill-port npm package)
change port of your meteor app
Generally in linux this error is connected with access to files, but on windows it seems to be connected with network issues. In all other threads winnat is mentioned, so if this will not help please add more context about your winnat config.
Node.js port permission denied in Windows 10
https://superuser.com/questions/1437780/how-to-fix-listen-eacces-permission-denied-on-any-port
You can read about deployment meteor on windows here and compare it with your:
Deploy Meteor on Windows
https://forums.meteor.com/t/one-deployment-method-for-a-meteor-application-on-windows/13928

"Error: Cannot find module '#app/foo'" in prod mode when using libs

I have a project where I built several modules. After finding that nestjs has a lib cli command I ported all of them to use this style.
Now my app can't find these modules when using npm run start:prod.
Error: Cannot find module '#app/foo'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/Users/xxx/Development/nest-test/dist/src/app.service.js:13:15)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
I created a project with the basic code and one library to reproduce the problem: https://github.com/hkeio/nestjs-test
Even when I link the package node is not able to find the module.
cd libs/foo
npm link
cd ../..
npm link #app/foo
When running NODE_DEBUG=* npm run start:prod I can see that he is looking at the right place but does not find the module:
MODULE 12494: looking for "#app/foo" in [
"/Users/xxx/Development/nest-test/dist/src/node_modules",
"/Users/xxx/Development/nest-test/dist/node_modules",
"/Users/xxx/Development/nest-test/node_modules",
"/Users/xxx/Development/node_modules",
"/Users/xxx/node_modules",
"/Users/node_modules",
"/node_modules",
"/Users/xxx/.node_modules",
"/Users/xxx/.node_libraries",
"/Users/xxx/.nvm/versions/node/v10.15.3/lib/node"
]
...
$ pwd
/Users/xxx/Development/nest-test/node_modules
$ ll #app
total 0
drwxr-xr-x 3 xxx staff 96 May 30 09:04 .
drwxr-xr-x 608 xxx staff 19456 May 30 09:04 ..
lrwxr-xr-x 1 xxx staff 65 May 30 09:04 foo -> ../../../../.nvm/versions/node/v10.15.3/lib/node_modules/#app/foo```
According to the docs of tsconfig-paths it can be used when executing the built sources with node.
The issue comment you are referencing also mentions execution with node.
Actually the problem occurs when executing the built files with node dist/main.js, not during the build process with tsc.
I managed to get a working solution by following theses instructions from tsconfig-paths docs. #bisonfoutu created an example repo here.
Add a file named tsconfig-paths-bootstrap.js to the root of the project, and paste the code from the docs in it.
Change the start:prod script to: node -r ./tsconfig-paths-bootstrap.js dist/main.js
You should now be able to compile and execute the project with TS paths. (be aware that you will not be able to compile if there is no path set in tsconfig.json)

What is the issue "node" is working but "nodemon" is not woking on windows 7 64-bit in node.js?

I am new to node.js. node is working fine but when I installed the nodemon package, it gives an error: exception in nodemon killing node, even when installed globally.
22 Jun 13:07:29 - [nodemon] v1.3.7
22 Jun 13:07:29 - [nodemon] to restart at any time, enter `rs`
22 Jun 13:07:29 - [nodemon] watching: *.*
22 Jun 13:07:29 - [nodemon] starting `node server.js`
exception in nodemon killing node
Error: spawn cmd ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
----------------------------------------------------------
If appropriate, please file an error with the output from:
$ node
C:\Users\username\AppData\Roaming\npm\node_modules\nodemon\bin\nodemon.
js server.js --dump
At http://github.com/remy/nodemon/issues/new
Possible solutions.
1. Permissions
The problem may be in your file permissions. Execute in git bash or from windows to give full permission to the project folder.
$ chmod -R 777 [folder]
2. Environment Variables
Missing "C:\Windows\System32" in the PATH.
Github issue
3. Reinstall
Altogether remove nodemon using npm and try reinstalling.
npm uninstall -g nodemon
4. Update nodejs
If you have an old version of NodeJS, try updating it. I prefer entirely removing NodeJS and reinstalling it again.
Step by steps to remove NodeJS in windows
Note: Your question may not be rich enough to answer correctly. Please include more information about questions if those didn't work.
Help spawn to locate your nodemon.cmd like this:
var nodemonCmd = (process.platform == 'win32') ? 'node_modules\\.bin\\nodemon.cmd' : 'nodemon'
myApp = spawn(nodemonCmd, ['build/server.bundle']);
Hope it works :)

Nodeclipse + Nodemon dont want to start apps

i set in prefences in Node Path C:!NnS\NodeJS!LIBS\nodemon.cmd
nodemod.cmd
"%~dp0\node.exe" "%~dp0\node_modules\nodemon\nodemon.js" %*
error
21 Aug 17:12:11 - [33m[nodemon] v0.7.10[0m
21 Aug 17:12:11 - [33m[nodemon] to restart at any time, enter rs[0m
21 Aug 17:12:11 - [32m[nodemon] watching: C:\Users\Admin\Desktop\nodeclipse-NTS-jee-kepler-win64\ws\NodeProject-1[0m
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
21 Aug 17:12:11 - [32m[nodemon] starting node C:\Users\Admin\Desktop\nodeclipse-NTS-jee-kepler-win64\ws\NodeProject-1\hello-world-server.js[0m
21 Aug 17:12:11 - [nodemon] exception in nodemon killing node
if i will start "nodemod.cmd app.js" all works
ps.
nodemon plugins for whatch on filechanges and make restart on any changes
https://github.com/remy/nodemon
Running node application with node-dev, forever, supervisor, nodemon etc
as of Nodeclipse 0.4.0 is not yet supported, issue #57 https://github.com/Nodeclipse/nodeclipse-1/issues/57
It is really smart to try enter path to such utils into Node path Preferences settings,
but it is not how that setting is meant to be used.
UPDATE (The solution you have mentioned) run app with a wrapper:
Looks like if in main app will be something like this... all will be ok :)
spawn("nodemon.cmd", ["main.js"]...
and
spawn("nodemon",[" --debug ./server.js 80"]...
But I personally would prefer to open console with StartExplorer see Plugins List
(right-click project -> StartExplorer -> open shell)
then nodemon main

Error: Cannot find module './lib/socket.io'

I had my server working with an earlier version of node.js, npm, and socket.io but after updating I started getting issues with socket.io:
$ node server.js
node.js:237
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module './lib/socket.io'
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> (/usr/local/lib/node_modules/socket.io/index.js:8:18)
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.require (module.js:357:17)
Before upgrading I had a symlink for socket.io under node_modules pointing to the "centrally installed" directory with the same name. Recently I tried installing socket.io local to my project by issuing the command:
npm install socket.io
which placed socket.io under node_modules in my project. I found it strange at first that the error message was saying "./lib/socket.io" but when I looked into it I found that project/node_modules/socket.io/index.js is requiring socket.io like so:
module.exports = require('./lib/socket.io');
But there is nothing there except transport:
...project/node_modules/socket.io/lib
$ ll
total 24
drwxrwxr-x 3 ghbarratt dev 4096 Mar 26 14:38 .
drwxrwxr-x 5 ghbarratt dev 4096 Mar 26 15:03 ..
-rw-rw-r-- 1 ghbarratt dev 10777 Mar 6 16:37 transport.js
drwxrwxr-x 3 ghbarratt dev 4096 Mar 26 14:38 transports
Should there be another socket.io directory or a socket.io.js file under lib? Why would index.js be requiring an internal file that seems to be missing?
Versions:
node -v
v0.7.7-pre
npm -v
1.1.12
socket.io#0.9.2
Distributor ID: Ubuntu
Description: Ubuntu 10.10
Release: 10.10
Codename: maverick
I hate to answer my own question, but I did get things resolved and there were no other answers so I am going to add this in case it can help someone else.
With Felix Loether's comment (which I +1ed) I was fairly certain that I did not get all the files I should have during the npm install socket.io. I tried doing an apt-get update/upgrade, thinking that I might need an update for tar or something, but the results were still the same.
I was noticing a 304 response in the install output and wondered at that point if there was some sort of npm cache that I should try clearing. I discovered I could clear the npm cache with the command: npm cache clean. Cleaning the cache finally got me past the no-errors-until-runtime issue.
I then started to get an error message: make: node-waf: Command not found which lead me to reinstall node.
And after all that, it worked!

Resources