question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting `EISDIR: illegal operation on a directory` when migrating from 8.x to 9.0

See original GitHub issue

Reproduction

Steps to reproduce:

  1. ng update @angular/cdk

Because there is not enough information provided by the migration, I am unable to provide a reproduction stackblitz.

Expected Behavior

Successful migration to v9, or at least a meaningful error message that tells me where something might be wrong.

Actual Behavior

What behavior did you actually see?

EISDIR: illegal operation on a directory, read
✖ Migration failed. See above for further details.

Any help is much appreciated🙏

Environment

  • Angular: 9
  • CDK/Material: 8.2.1 -> 9.0.0
  • Browser(s): N/A
  • Operating System (e.g. Windows, macOS, Ubuntu): OSX

The error seemed similar to this issue https://github.com/angular/angular/issues/31056, but all the examples in that repo shows that additional error information

$ ng update @angular/cdk --verbose
Locating potential npmrc files:
Trying '/usr/local/etc/npmrc'...not found.
Trying '/Users/foo/.npmrc'...found.
Trying '/Users/.npmrc'...not found.
Trying '/Users/foo/.npmrc'...found.
Trying '/Users/foo/dev/.npmrc'...not found.
Trying '/Users/foo/dev/node/.npmrc'...not found.
Trying '/Users/foo/dev/node/fusekit/.npmrc'...found.
Using package manager: 'npm'
Collecting installed dependencies...
Found 186 dependencies.
Fetching dependency metadata from registry...
    Locating potential npmrc files:
    Trying '/usr/local/etc/npmrc'...not found.
    Trying '/Users/foo/.npmrc'...found.
    Trying '/Users/.npmrc'...not found.
    Trying '/Users/foo/.npmrc'...found.
    Trying '/Users/foo/dev/.npmrc'...not found.
    Trying '/Users/foo/dev/node/.npmrc'...not found.
    Trying '/Users/foo/dev/node/fusekit/.npmrc'...found.
    Updating package.json with dependency @angular/cdk @ "9.0.0" (was "8.2.1")...
UPDATE package.json (9582 bytes)
✔ Packages installed successfully.
** Executing migrations of package '@angular/cdk' **

❯ Updates the Angular CDK to v9
EISDIR: illegal operation on a directory, read
✖ Migration failed. See above for further details.

$ 

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
devversioncommented, Feb 7, 2020

Thanks @paustint for all the information. This helps a lot. I think there are a few things we could do:

  1. Make sure that we don’t glob for directories matching the style extension.
  2. Do not depend on globs for finding global project stylesheets which are not part of a component.
    • We can do this by consulting the angular.json file and styles configuration.

Long-term we should explore (2) as using a glob is obviously not ideal.

1reaction
paustintcommented, Feb 7, 2020

OK - I found out some possible useful information.

  1. When I ran the migration from the node_modules/@angular directory, the migration was successful and 0 files aside from package.json and package-lock.json were updated (which means I likely do not have anything to migrate)
  2. When I ran the migration from the project root, after making the cli change, I get the following error message:
An unhandled exception occurred: EISDIR: illegal operation on a directory, read
See "/private/var/folders/l0/wtqgh8410tj2s_vz_n6h18y00000gp/T/ng-ZKRRHi/angular-errors.log" for further details

And that log shows this:

[error] Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:513:3)
    at tryReadSync (fs.js:338:20)
    at Object.readFileSync (fs.js:375:19)
    at ComponentResourceCollector.resolveExternalStylesheet (/Users/foo/dev/node/foo/node_modules/@angular/cdk/schematics/update-tool/component-resource-collector.js:137:38)
    at /Users/foo/dev/node/foo/node_modules/@angular/cdk/schematics/update-tool/index.js:87:50
    at Array.forEach (<anonymous>)
    at Object.runMigrationRules (/Users/foo/dev/node/foo/node_modules/@angular/cdk/schematics/update-tool/index.js:86:14)
    at runMigration (/Users/foo/dev/node/foo/node_modules/@angular/cdk/schematics/ng-update/upgrade-rules/index.js:77:46)
    at /Users/foo/dev/node/foo/node_modules/@angular/cdk/schematics/ng-update/upgrade-rules/index.js:80:37
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/foo/dev/node/foo/node_modules/@angular/cdk/schematics/ng-update/upgrade-rules/index.js:80:24)
    at Generator.next (<anonymous>)
    at /Users/foo/dev/node/foo/node_modules/@angular/cdk/schematics/ng-update/upgrade-rules/index.js:14:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/foo/dev/node/foo/node_modules/@angular/cdk/schematics/ng-update/upgrade-rules/index.js:10:12)
    at /Users/foo/dev/node/foo/node_modules/@angular/cdk/schematics/ng-update/upgrade-rules/index.js:61:35
Read more comments on GitHub >

github_iconTop Results From Across the Web

NPM stuck giving the same error EISDIR: Illegal operation on ...
EISDIR stands for "Error, Is Directory". This means that NPM is trying to do something to a file but it is a directory....
Read more >
sfdx cli throwing error "EISDIR: illegal operation on a directory ...
You are getting the permission issues because you are probably running sfdx as your user but the sfdx dirs are owned by root....
Read more >
angular/angular-cli - Gitter
@cDecker32 I get the following weird error if I try that.. there is no permissions issue here though -. EISDIR: illegal operation on...
Read more >
[error: eisdir: illegal operation on a directory, read] { errno ...
If the file is empty or doesn't exist then you don't have any configurations (at that level) and you can move on to...
Read more >
Laravel 8 - problem with scss and npm run dev - Laracasts
When trying to compile the scss file I get this error: npm run dev > @ dev ... Error: EISDIR: illegal operation on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found