react-ace icon indicating copy to clipboard operation
react-ace copied to clipboard

yarn upgrade to 9.4.0 fails with ENOTDIR

Open amneacsu opened this issue 3 years ago • 9 comments

Problem

Upgrading react-ace from 9.3.0 to 9.4.0 fails if using yarn. Apparently one of the paths in node_modules/react-ace changed from file to dir. Erasing node_modules and reinstalling dependencies seems to fix the issue, but is not ideal (multiple devs machines, CI cache, etc.).

yarn upgrade v1.22.5
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
error An unexpected error occurred: "ENOTDIR: not a directory, lstat '/...../node_modules/react-ace/dist/react-ace.min.js/main.js.LICENSE.txt'".

Sample code to reproduce your issue

yarn init
yarn add [email protected] react react-dom
yarn upgrade [email protected]

References

Progress on: #

amneacsu avatar Apr 26 '21 08:04 amneacsu

I have a quite similar problem, and reproducing is not really stable The majority of the times that's another error:

error An unexpected error occurred: "ENOTDIR: not a directory, lstat '/project/node_modules/react-ace/dist/react-ace.min.js/main.js'".

zmeecer avatar Apr 26 '21 08:04 zmeecer

@zmeecer thank you for adding that. Your error message is what our builds are failing with too. The minimal repro mentions a different file, but I have a feeling the underlying cause is the same.

amneacsu avatar Apr 26 '21 08:04 amneacsu

The upgrade failed too with the same error. I just had to remove the node_module folder, yarn.lock and reinstall the modules to make the project work again. Still don't know why this issue happened.

OlivierNguyen avatar May 04 '21 18:05 OlivierNguyen

+1 – I tried @OlivierNguyen's solution and unfortunately I'm still having the same issue :/

indify-co avatar Jun 06 '21 00:06 indify-co

Trying to update from 7.0.5 to 9.3.0 seems to fail with same error =/

klesun avatar Jun 10 '21 13:06 klesun

I just had to remove my node_modules, reinstall them and it was solved

CyrilQuandalle avatar Jun 18 '21 14:06 CyrilQuandalle

This issue seems to be caused by an older(?) version of react-ace having react-ace.min.js as a file, not a folder. Seemingly during the upgrade the old file isn't removed, which is why this is failing.

Our simplest fix was to check for the existence of that file and remove react-ace before reinstalling:

[ -f 'node_modules/react-ace/dist/react-ace.min.js' ] && rm -rf node_modules/react-ace && yarn install

jamgregory avatar Aug 18 '21 10:08 jamgregory

It looks like some library in my project depends on react-ace and I'm facing the same issue when trying to upgrade.

error An unexpected error occurred: "ENOTDIR: not a directory, lstat '/[...]/node_modules/react-ace/dist/react-ace.js/main.js'".

During one attempt the error pointed to /node_modules/react-ace/dist/react-ace.min.js/main.js.LICENSE.txt.

I tried to remove the entire node_modules dir and also tried @jamgregory solution but nothing seemed to work.

From my yarn.lock file, this is the react-ace version my project is using:

% cat yarn.lock | grep react-ace
    react-ace "^5.0.1"
react-ace@^5.0.1:
  resolved "https://registry.yarnpkg.com/react-ace/-/react-ace-5.10.0.tgz#e328b37ac52759f700be5afdb86ada2f5ec84c5e"

straube avatar Jan 17 '22 13:01 straube

fwiw -- was seeing a similar issue locally, and now on our CI environment when attempting to upgrade to 9.5 or 10:

error An unexpected error occurred: "ENOTDIR: not a directory, lstat '/home/circleci/ui/node_modules/react-ace/dist/react-ace.js/main.js'".

My local seems to have resolved by now, but going to try to make sure CI is not using a cached node_modules folder as it is still dying.

jeffbax avatar May 19 '23 17:05 jeffbax