Running Windows 8.1 and my environment is working great except I cannot start node in --debug so that node-inspector has something to connect to.
I have a Gruntfile setup with grunt-concurrent that lets me open, grunt-devtools, node-inspector then watch just fine but I can't figure out a workable syntax for getting that running with node in debug. Following is what I'd expect to work but also the error I get when I try. Notice that there is a message indicating that the debug server is listening, but something falls apart from there and fails so it does me no good.
C:\PROJECTS\bManWebService_Hapi>node --debug C:\Users\rainabba\AppData\Roaming\npm\grunt server
debugger listening on port 5858
C:\Users\rainabba\AppData\Roaming\npm\grunt:2
basedir=`dirname "$0"`
^
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:437:25)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
It looks like the file C:\Users\rainabba\AppData\Roaming\npm\grunt is not a JS file but a bash shell script. Look for grunt.cmd in the same folder if you need Windows-compatible version.
And event if you find grunt.cmd - starting it as node grunt.cmd is not a proper way. Most likely the grunt.cmd will start the node so you need to somehow pass the --debug argument to the node, called by the grunt.cmd or just run node exactly as grunt.cmd runs it.
tl; tr;
node --debug-brk c:\Users\rainabba\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt taskname
You have to use this executable
c:\Users\rainabba\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt
instead of this
c:\Users\rainabba\AppData\Roaming\npm\grunt server
Related
I'm looking to create my own external adapter. I pulled the external adapter repo and set it up with yarn per the README. However, when I try running cd packages/sources/coingecko && yarn start within any of the adapter directories, I get the following error:
/Users/jvilla/Documents/GitHub/external-adapters-js/packages/core/bootstrap/dist/lib/cache/index.js:73
if (!context?.cache?.instance)
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:1053:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.external_module_.Module._load (/Users/jvilla/Documents/GitHub/external-adapters-js/.pnp.cjs:42492:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/Users/jvilla/Documents/GitHub/external-adapters-js/packages/core/bootstrap/dist/index.js:6:17)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
The README mentions that some require environmental variables, but I don't see anything mentioned in coingecko and I'm not having any luck with the other adapters either.
Thanks to help in the Discord, I was able to resolve my issue. I was using an old version of node and needed to upgrade! The separate, but related, Chainlink Node Operator repo README has Node v12 hardcoded in its setup process, which won't work when running the External Adapter repo.
I am on windows 10, using vscode. Basically finished the petshop tutorial with no issues or problems using truffle.
when I enter the command npm run dev it fails as shown below.
PS Y:\code\petshop> npm run dev
> pet-shop#1.0.0 dev
> lite-server
internal/modules/cjs/loader.js:316
throw err;
^
Error: Cannot find module 'Y:\code\petshop\node_modules\immutable\dist\immutable'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:308:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:521:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:872:27)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (Y:\code\petshop\node_modules\browser-sync\dist\hooks.js:3:17)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32) {
code: 'MODULE_NOT_FOUND',
path: 'Y:\\code\\petshop\\node_modules\\immutable\\package.json',
requestPath: 'immutable'
}
Not sure where to go from here, nothing works. This type of error is a bit beyond me. Any and all help is greatly appreciated.
EDIT: changed screenshot to code snippet. And I realized the problem is that the 'immutable' path is non-existent in my node_modules. Still not sure how to address this. tried a cheeky npm install immutable to no avail....
internal/modules/cjs/loader.js:750
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: Your organization used Device Guard to block this app. Contact your support person for
more info.
\\?\C:\Users\C5281145\AppData\Roaming\sass-binary\win32-x64-67\binding.node
at Object.Module._extensions..node (internal/modules/cjs/loader.js:750:18)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:22:18)
at module.exports (C:\SRM\SRM_Workspace\sr\infonet\src\main\resources\node\node_modules\node-
sass\lib\binding.js:19:10)
at Object.<anonymous>
(C:\SRM\SRM_Workspace\sr\infonet\src\main\resources\node\node_modules\node-
sass\lib\index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
I have tried uninstalling node_modules and then running yarn command
Tried everything on google..
Nothing worked for me
I've been stuck with this same problem this one whole day. After hours of digging, finally I solved it by updating my PC's Microsoft Visual C++ Redistributable file. You may find the download link here: https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0
Hope your problem will be solved as well!
Thanks a lot to Solant#Github!
I had a similar issue while trying to execute this single nodejs script from Windows 10: const cv = require('opencv4nodejs');
The solution: to start the command line as an administrator, before issuing the command: node <yourScript>
I was trying to set up a running instance running on Heroku by following these instructions. All goes well but after the build is finished, an error occurs and the app crashed.
Error: Cannot find module /app/.meteor/heroku_build/bin/boot_proxy.js
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
Process exited with status 1
This is the content of the Procfile.
web: .meteor/heroku_build/bin/node .meteor/heroku_build/bin/boot_proxy.js .meteor/heroku_build/bin/node .meteor/heroku_build/app/main.js
I used heroku bash to explore the app and saw that The file boot_proxy.js is not being generated. Does anyone know a fix to this? Already filed a bug on git repo.
As it can be found in this forked repo the missing boot_proxy.js comes from a overdue startup of reaction:
Sometimes reaction takes too much time to start and Heroku thinks that there's a problem with your app. To sidestep this we have a simple proxy that answers every request until it's ready.
https://github.com/Zanobo/reaction-buildpack#boot-proxy
So in order to fix the issue, you should use this fork at the buildpack step:
heroku buildpacks:set https://github.com/Zanobo/reaction-buildpack.git
and add this environment variable in Heroku:
USE_BOOT_PROXY=1
I have a NodeJs module "some-module" that I want to have installed globally so it can be run directly from the command line without the node executable prefix. ie: $> some-module [args] I would like one of those arguments to be --debug. The reasoning for this is that I don't want to require users of this module to install it to their local directory just to run node --debug-brk node_modules/some-module/[path to entry point] [args].
The NodeJs documentation states in it's advanced usages section on debugging (http://nodemanual.org/latest/nodejs_ref_guide/debugging.node.js.html)
The V8 debugger can be enabled and accessed either by starting Node.js with the --debug command-line flag or by signaling an existing Node.js process with SIGUSR1.
I tried doing this with:
process.kill(process.pid, 'SIGUSR1');
Which produced the error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Unknown signal: SIGUSR1
at EventEmitter.kill (node.js:366:17)
at Object.<anonymous> (c:\dev\some-module\app.js:94:17)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:40)
What do I need to do to get the running process switched to debug mode?
Also, I would like to debug the given application with node-inspector.
I'm not quite sure if I understood your question, but...
You can probably install an app globally and have it stop in a breakpoint using npm. In package.json put:
...
"scripts": {"start": "node --debug-brk some-module.js"},
"bin" : { "some-module" : "./some-module.js" },
...
Running npm start -g some-module will break at first line.
You can then use node-inspector for debugging.
About the part with stopping from within the code, node has a build in debugger (which is quite rudimentary), but it allows this functionality.
If you include somewhere in the code:
debugger;
and run:
node debug some-module.js
it will stop there in the debugger (note: this is not the same as node-inspector, i don't know if this can be achieved with node-inspector).
Don't really understand the reason why you're doing this, but hope this helps.