2016-11-23 48 views
0

當試圖通過npm安裝我編譯打字稿輸出作爲本地包,我收到以下錯誤信息:NPM無法安裝本地包:EISDIR:在目錄上非法操作,讀

$ 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

我在嘗試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.jsonapp/out/package.json來解決這個問題。