環境
[root@localhost ~]# npm -v
6.9.0
[root@localhost ~]# node -v
v10.16.3
下記エラーがでる。
> mypj@1.0.0 start /root/mypj
> npm run build && node -r source-map-support/register .
> mypj@1.0.0 build /root/mypj
> tsc
src/__tests__/acceptance/home-page.acceptance.ts:5:1 - error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`.
5 describe('HomePage', () => {
~~~~~~~~
src/__tests__/acceptance/home-page.acceptance.ts:9:3 - error TS2304: Cannot find name 'before'.
9 before('setupApplication', async () => {
~~~~~~
src/__tests__/acceptance/home-page.acceptance.ts:13:3 - error TS2304: Cannot find name 'after'.
13 after(async () => {
~~~~~
src/__tests__/acceptance/home-page.acceptance.ts:17:3 - error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`.
17 it('exposes a default home page', async () => {
~~
src/__tests__/acceptance/home-page.acceptance.ts:24:3 - error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`.
24 it('exposes self-hosted explorer', async () => {
~~
src/__tests__/acceptance/ping.controller.acceptance.ts:5:1 - error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`.
5 describe('PingController', () => {
~~~~~~~~
src/__tests__/acceptance/ping.controller.acceptance.ts:9:3 - error TS2304: Cannot find name 'before'.
9 before('setupApplication', async () => {
~~~~~~
src/__tests__/acceptance/ping.controller.acceptance.ts:13:3 - error TS2304: Cannot find name 'after'.
13 after(async () => {
~~~~~
src/__tests__/acceptance/ping.controller.acceptance.ts:17:3 - error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`.
17 it('invokes GET /ping', async () => {
~~
Found 9 errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! mypj@1.0.0 build: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the mypj@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-09-21T08_53_22_311Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! mypj@1.0.0 start: `npm run build && node -r source-map-support/register .`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the mypj@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-09-21T08_53_22_334Z-debug.log
グローバルじゃなくてローカルに下記2つインストールで解決する。
npm i @types/mocha
npm i @types/jest
Read More