{"id":4549,"date":"2016-06-20T01:19:59","date_gmt":"2016-06-20T01:19:59","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=4549"},"modified":"2016-06-20T01:19:59","modified_gmt":"2016-06-20T01:19:59","slug":"node-error-not-recognized-internal-external-command-fixed","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/node-error-not-recognized-internal-external-command-fixed\/","title":{"rendered":"Node error: &#8216;..&#8217; is not recognized as an internal or external command [fixed]"},"content":{"rendered":"<p>If you try to execute commands in Node, you can get weird errors like this:<\/p>\n<pre>\n'..' is not recognized as an internal or external command, \noperable program or batch file.\n<\/pre>\n<p>Apparently Node doesn&#8217;t exactly shell this out the way you&#8217;d expect. Here is an example of something that would generate this error:<\/p>\n<pre lang=\"javascript\">\nexec(\n  '..\/script.sh', \n  (error: any, stdout: any, stderr: any) => { \n    ..\n  }\n);\n<\/pre>\n<p>Rather than referencing the full path to the script, you can set the &#8220;cwd&#8221; parameter in the &#8220;options&#8221; argument to exec:<\/p>\n<pre lang=\"javascript\">\nexec(\n  'script.sh', \n  {cwd: '..\/data'},\n  (error: any, stdout: any, stderr: any) => { \n    ..\n  }\n);\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Fixing errors using &#8220;..&#8221; in Node.js scripts that call shell scripts<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9],"tags":[302,387,388],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/4549"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=4549"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/4549\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=4549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=4549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=4549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}