npm无法安装本地软件包:EISDIR:对目录进行非法操作,读取

时间:2016-11-23 20:54:06

标签: node.js typescript npm

当尝试通过npm将我编译的TypeScript输出安装为本地包时,收到以下错误消息:

$ 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.

1 个答案:

答案 0 :(得分:0)

我在尝试npm install从TypeScript编译的本地包时遇到了这个问题。我的目录结构如下所示:

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

npm抱怨,因为../app/out/是一个目录,而不是一个包。我通过将app/package.json复制到app/out/package.json来解决此问题。