15

ENOTDIR: not a directory, open package.json Solution

 2 years ago
source link: https://finisky.github.io/en/npm-enotdir-error-solution/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

ENOTDIR: not a directory, open package.json Solution

2022-11-16 Linux

When I install elasticdump, the following error appears:

$ npm install elasticdump
...
npm WARN @1.0.0 No description
npm WARN @1.0.0 No repository field.
npm ERR! Linux 5.4.0-1091-azure
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "elasticdump"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! path /home/finisky/node_modules/.staging/@types/node-1f2b596d/package.json
npm ERR! code ENOTDIR
npm ERR! errno -20
npm ERR! syscall open

npm ERR! ENOTDIR: not a directory, open '/home/finisky/node_modules/.staging/@types/node-1f2b596d/package.json'

I spent hours to figure out the root cause: npm is deprecated (v3.5.2).

Solve the issue is easy, just upgrade npm:

$ curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
$ sudo apt install nodejs

Then:

$ npm --version
8.19.2

Reinstall elasticdump and you are done!

$ npm install elasticdump

</div


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK