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
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:
- Call ngOnInit() again from another function – Angular 9 ?
- ngOnChanges get new value and previous value – Angular
- Global Angular CLI version is greater than your local version
- Upgrade Angular CLI to the latest version Angular 9 or 10 ?
- How to use new static option in ViewChild Angular 9 ?
- Project contents into angular components using ng-content
- Call ngOnInit() again from another function – Angular 9 ?
- ngAfterContentInit with Example – Angular
- make npm install command to work behind proxy ?
- Node Sass could not find a binding for your current environment
- ngOnDestroy Example Angular
- Angular Component : In which lifecycle hook you can check value of DOM element ?
- @ContentChild TypeError: Cannot read property ‘nativeElement’ of undefined
- Access ng-content with @ContentChild – Angular Component
- How to select an element in a component template – Angular ?
- Difference between @ViewChild and @ContentChild – Angular Example
- Expected 0 type arguments, but got 1 : Angular
- Angular – Access template reference variables from component class ?
- Pass variable from parent to custom child component – Angular 9
- Uninstall Nodejs completely from Mac OSX ?
- EventEmitter parameter value undefined for listener
- Typescript Error: Property does not exist on value of type
- Remove http and https proxy settings of npm and git ?
- How to change node version using nvm ?
A very very thanks to you bro… To help me out