当尝试通过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.
答案 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
来解决此问题。