0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

npm installしたら「No inputs were found in config file」が出た

Posted at

経緯

typescriptの勉強中、新しく「section2」ディレクトリを作って、
「section1」ディレクトリにあった下記のディレクトリ・ファイルを移動させた。

section2
/dist
/src
package.json
tsconfig.json

移動後、npm installを実行したら下記のエラーが出た。
ts.configの設定でなんか失敗したっぽい?

npm install

npm WARN deprecated tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.

> section1@1.0.0 prepublish
> npm run build


> section1@1.0.0 build
> tsc

error TS18003: No inputs were found in config file 'C:typescript/section2/tsconfig.json'. Specified 'include' paths were '["src/**/*"]' and 'exclude' paths were '["node_modules","dist"]'.


Found 1 error.

npm ERR! code 2
npm ERR! path C:typescript/section2
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npm run build

npm ERR! A complete log of this run can be found in:

原因

最初はnode_modulesフォルダが存在しないことで怒られているのかと思ったけど、
installして初めてできるものだから関係ない。

https://insider.10bace.com/2017/11/29/typescript-ts18003-error/ の記事を参考にすると、ディレクトリ内にtsファイルが存在しないとだめってことで怒られたらしい。
srcの中にダミーファイルとしてindex.tsを作り、作成されたnode_modulespackage-lock.jsonを消してもう一度installを実行。

npm install
npm WARN deprecated tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.  

> section1@1.0.0 prepublish
> npm run build


> section1@1.0.0 build
> tsc

src/index.ts:1:2 - error TS1127: Invalid character.

1 {\rtf1}
 

Found 1 error in src/index.ts:1

npm ERR! code 2
npm ERR! path C:typescript/section2
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npm run build

npm ERR! A complete log of this run can be found in:

なんで!?って思ってよく見たらindex.tsの記述がおかしいぞってちゃんと出ていた…
ファイルの中を空にして再実行したら下記のように成功!
エラーはちゃんと読まなきゃダメだね…

npm install
npm WARN deprecated tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.  

> section1@1.0.0 prepublish
> npm run build


> section1@1.0.0 build
> tsc


added 42 packages, and audited 43 packages in 4s

5 packages are looking for funding
  run `npm fund` for details

2 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

今回の学び

・npm install失敗したときは、ダミーのtsファイルが入っているか確認する
・ダミーのtsファイルは空っぽにしておくか、正しいtsコードを入れておく
・エラーはちゃんと読む

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?