简体   繁体   中英

npm can't install local package: EISDIR: illegal operation on a directory, read

When trying to install my compiled TypeScript output as a local package via npm , I get the following error message:

$ npm install --save ../app/out

npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.

I encountered this issue when trying to npm install a local package I compiled from TypeScript. My directory structure looked like this:

app/
  package.json
  lib/
    some_code.ts
  out/
    lib/
      some_code.d.ts
      some_code.js
tests/
  package.json // npm install ../app/out

npm is complaining because ../app/out/ is a directory, not a package. I fixed this by copying app/package.json to app/out/package.json .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM