Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Node.js process.cwd() "no such file or directory" Starting HTTP-Server

DZone's Guide to

Node.js process.cwd() "no such file or directory" Starting HTTP-Server

Learn how to resolve a "no such file or directory" error in node.js with this simple, effective code snippet.

· DevOps Zone
Free Resource

Best practices for getting to continuous deployment faster and with dramatic results in reduced outage minutes, development costs, and QA testing cycles. Brought to you by Rainforest QA.

When starting the node.js http-server, I got this error:

Error: ENOENT, no such file or directory
at Error (native)
at Function.startup.resolveArgv0 (node.js:720:23)
at startup (node.js:63:13)
at node.js:814:3

From the post here, it seems this error can occur if you attempt to start the server in a dir that’s already been deleted. In my case I had renamed a folder that contained the folder where I was attempting to start the server. cd’d up a couple and into the new/renamed folder, and problem solved.

 

Discover how to optimize your DevOps workflows with our on-demand QA solution, brought to you in partnership with Rainforest QA.

Topics:
devops ,javascript ,node.js ,http

Published at DZone with permission of Kevin Hooke, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}