Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 cli - ng serve gives 'EIO: i/o error'

I'm working on building a portfolio website using Angular 2. I know there's simpler ways to go about it, but this is also a refresher for me as it's been a while since I've used Angular 2.

When I try to use 'ng serve' to run my project, it crashes and gives this: '''"An unhandled exception occurred: EIO: i/o error, read See "C:\Users...\angular-errors.log" for further details."'''

The error log just looks like any other error in code:

[error] Error: EIO: i/o error, read
at Object.readSync (fs.js:506:3)
at tryReadSync (fs.js:331:20)
at Object.readFileSync (fs.js:360:19)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:994:22)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (D:\...\portfolio-website\node_modules\webpack-dev-server\node_modules \braces\lib\utils.js:13:19)
at Module._compile (internal/modules/cjs/loader.js:959:30)

This error started happening when I reset my PC yesterday but kept my files. I still had to reinstall node and angular because windows lost the path keys (or environment variables or whatever lol)

I opened up an administrator command prompt and tried from that, and it woks fine. Is there an ownership issue with the files?

I've searched for a couple of hours and nothing is for this error, and nothing suggested is either relevant or works. Everything I'm using is up to date (unless maybe I don't realize I'm using it? I only started a few days ago)

Versions: Angular: 8.3.21 Node: 12.14.0 npm: 6.13.4

like image 431
kingzustin Avatar asked Sep 04 '26 13:09

kingzustin


1 Answers

After much googling, ensuring packages were updated, and slamming my head against the desk, I solved the problem.

My hard drive has a bad sector, and my node_modules\.bin is corrupt.

I copied everything but node_modules to a new folder, then ran npm install.

Everything works now!

like image 187
kingzustin Avatar answered Sep 06 '26 06:09

kingzustin