trying to run an execsync on a command but keeps getting ... is not recognized as an internal - node.js

i am trying to run a postgresql dump from execsync command but I keep getting the following error:
Command failed: pg_dump --no-owner --file=d:\\Dev\\...\\..\\..\\...\\...bak postgres://Username:password#serverlocation:portnumber//DB name
'pg_dump' is not recognized as an internal or external command,
operable program or batch file.
I have no spaces in the folder structure.
running the same exact command in cmd works fine (I am using a windows machine).
This is the command I am trying to run:
const command = 'pg_dump --no-owner --file=d:\\Dev\\...\\..\\..\\...\\...bak postgres://Username:password#serverlocation:portnumber//DB name'
let result = execSync(command)
Your help is highly appreciated.

The issue was resolved by restarting the machine.

Related

Unable to set path for nodejs

When I try to check the version of nodejs by running he command in my terminal "node -v" its shows 'node' is not recognized as an internal or external command,
operable program or batch file. I tried to set the path but the nodejs folder is not in my pc. Please help me out.enter image description here

Node is not recognized

so I use atom, I have installed script and when i try to execute my javascript I get this error:
[Command: cmd '/c C:\Users\Stelios\.atom\packages\script\node_modules\.bin\babel --filename C:\Users\Stelios\.atom\packages\script\node_modules\.bin\babel < C:\Users\Stelios\AppData\Local\Temp\atom_script_tempfiles\08a4ca80-fe01-11e8-bc01-85e8d2a83c37.js| node']
'node"' is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.075s]
Any thoughts how to fix this? I created a folder called node.js in program files set a path and it did not work..
Node is not recognized means either node is not installed or path is not set.
So install Node JS on your Windows machine from https://nodejs.org/en/download/
Check out this guide on how to install Node properly while setting path - https://blog.teamtreehouse.com/install-node-js-npm-windows

Command line in Windows and Node.js

I just installed node.js and try to execute my first "Hellow world" on it based on React.js
I moved step by step according to this article: https://www.kirupa.com/react/setting_up_react_environment.htm
All were fine untill I try to execute application through windows command line by command ./node_modules/.bin/webpack. The result is error: '.' is not recognized as an internal or external command,
operable program or batch file.
How to solve this issue?
Windows uses \ as the path separator. Just do .\node_modules\.bin\webpack

How to pass parameters to node.js from Windows command line

I'm working in a node application that can be started like this from a Mac machine:
DEBUG=app.* ENVIRONMENT=local node server/index.js
However, when trying to run that script in a Windows command line, I get the following message:
" 'DEBUG' is not recognized as an internal or external command, operable program or batch file."
When running the script without the parameters, I don't get any error.
How can I pass said parameters to my index.js from Windows?
Run this in the CMD window where you'll run your node app.
SET DEBUG=app.*
SET ENVIRONMENT=local
node server/index.js
Or if you want it to be in a single line, type this.
SET DEBUG=app.*&&SET ENVIRONMENT=local&&node server/index.js
To make this variable changes persistent, you should edit your environment variables in control panel.

gulp-shell 'karma is not recognized an an internal or external command...'

I'm using gulp to concat, minify, and then test all of my JS. I want to include karma in there as well, but I can't seem to get gulp-shell 'karma start karma.conf.js' to work properly. Karma is added to PATH, as I'm able to run that command from the same working directory as the gulpfile in Windows Shell without any problems. I can also run other commands correctly, like 'ls', 'pwd', 'npm --version', etc but for some reason it doesn't recognize 'karma'.
I have also gotten this running on OSX properly, so it's an issue local to my machine. Any help would be appreciated.
gulp.task('run-karma', shell.task(['karma start karma.conf.js']));
error is
'karma' is not recognized as an internal or external command,
operable program or batch file.
Error in plugin 'gulp-shell' Message:
Command 'karma start karma.conf.js' failed with exit code 1

Resources