Nodejs Error: ENOENT: no such file or directory

Fix Nodejs Error: ENOENT: no such file or directory

This tutorial guides you on how to fix Nodejs Error: ENOENT: no such file or directory while running your node project or any application which contains Nodejs component.

Fix Nodejs Error: ENOENT: no such file or directory

Nodejs Error: ENOENT: no such file or directory

When I tried to download guacamole-client whose frontend is developed using Nodejs, and I tried to setup installing guacamole natively on Windows machine.

After downloading the code, I was trying to build guacamole-client which includes Nodejs frontend component by running “mvn package” command as shown below. But it resulted with error “Error: ENOENT: no such file or directory, open ‘C:\Users\Documents\Work\guacamole-client-master\guacamole\src\main\frontend\dist\npm-dependencies.txt’

> mvn package
---
---
[INFO] <i> [dependency-list-plugin] Skipping file dependency "src\app\textInput\directives\guacKey.js" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "src\app\textInput\directives\guacTextInput.js" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "src\app\textInput\styles\textInput.css" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "src\app\textInput\textInputModule.js" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "src\app\touch\directives\guacTouchDrag.js" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "src\app\touch\directives\guacTouchPinch.js" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "src\app\touch\touchModule.js" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "src\index.html" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "src\relocateParameters.js" (no NPM package)
[INFO] [webpack-cli] Error: ENOENT: no such file or directory, open 'C:\Users\Documents\Work\guacamole-client-master\guacamole\src\main\frontend\dist\npm-dependencies.txt'
[INFO]     at Object.openSync (fs.js:476:3)
[INFO]     at Object.writeFileSync (fs.js:1467:35)
----
[INFO]     at AsyncSeriesHook.lazyCompileHook (C:\Users\Documents\Work\guacamole-client-master\guacamole\src\main\frontend\node_modules\tapable\lib\Hook.js:154:20)
[INFO]     at C:\Users\Documents\Work\guacamole-client-master\guacamole\src\main\frontend\node_modules\webpack\lib\Compilation.js:1414:32 {
[INFO]   errno: -4058,
[INFO]   syscall: 'open',
[INFO]   code: 'ENOENT',
[INFO]   path: 'C:\\Users\\Documents\\Work\\guacamole-client-master\\guacamole\\src\\main\\frontend\\dist\\npm-dependencies.txt'
[INFO] }
[INFO] npm ERR! code ELIFECYCLE
[INFO] npm ERR! errno 2
[INFO] npm ERR! @ build: `webpack --progress`
[INFO] npm ERR! Exit status 2
[INFO] npm ERR!
[INFO] npm ERR! Failed at the @ build script.
[INFO] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[INFO]
[INFO] npm ERR! A complete log of this run can be found in:
[INFO] npm ERR!     C:\Users\AppData\Roaming\npm-cache\_logs21-07-28T14_42_52_884Z-debug.log

The above command “mvn package” is supposed to invoke maven to automatically build and package all the components, producing a single .war file. And while building frontend Nodejs component, it was looking for a file called “npm-depedencies.txt” but that file is missing.

Solution

As you can see from the above error, that it is expecting file called “npm-dependencies.txt” to be there in specific path. But it does not exist.

code: 'ENOENT',

path: 'C:\\Users\\Documents\\Work\\guacamole-client-master\\guacamole\\src\\main\\frontend\\dist\\npm-dependencies.txt'

ENOENT means Error NO ENTry (or Error NO ENTity) or simply you can say that there is NO such directory ENTry.

Therefore, you either need to create the expected file in the specific path i.e., under dist directory or else reconfigure your application so that it will point to the correct directory path for the required file.

After fixing, try building your application again. The Nodejs Error: ENOENT: no such file or directory should have gone away now.

Hope it helped đŸ™‚

Also see:

References:

Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Mnameet
Mnameet
1 year ago

A very very thanks to you bro… To help me out