Хапи джой причина разбора модуля не удалась - PullRequest
0 голосов
/ 18 октября 2019

Я получил эту ошибку после того, как я запустил

npm i @hapi/joi --save

и затем включил ее в свой проект следующим образом

import { joi } from "@hapi/joi";
or
const joi = require("@hapi/joi");

, и я получил эту ошибку при запуске npm start

ERROR in ./node_modules/@hapi/joi/lib/types/string/index.js
Module parse failed: Unexpected token (168:67)
You may need an appropriate loader to handle this file type.
|                 Common.assertOptions(options, ['paddingRequired', 'urlSafe']);
| 
|                 options = { urlSafe: false, paddingRequired: true, ...options };
|                 Assert(typeof options.paddingRequired === 'boolean', 'paddingRequired must be boolean');
|                 Assert(typeof options.urlSafe === 'boolean', 'urlSafe must be boolean');
 @ ./node_modules/@hapi/joi/lib/index.js 30:16-41
 @ ./src/services/fieldDefinitionsValidation.service.ts
 @ ./src/config/ioc.container.ts
 @ ./src/_lambda-handlers/reservationsDelete.ts

ERROR in ./node_modules/@hapi/joi/lib/trace.js
Module parse failed: Unexpected token (203:47)
You may need an appropriate loader to handle this file type.
|     filter(schema, state, source, value) {
| 
|         internals.debug(state, { type: source, ...value });
| 
|         this._record(schema, (log) => {
 @ ./node_modules/@hapi/joi/lib/index.js 14:14-32
 @ ./src/services/fieldDefinitionsValidation.service.ts
 @ ./src/config/ioc.container.ts
 @ ./src/_lambda-handlers/reservationsDelete.ts

ОШИБКА в ./node_modules/@hapi/joi/lib/modify.js Ошибка синтаксического анализа модуля: неожиданный токен (246: 44) Вам может потребоваться соответствующий загрузчик для обработки этого типа файла. |options.ref! == false && Ref.isRef (item)) {||const result = options.each (item, {... source, path, key: _key});|if (result === item) {|вернуть;@ ./node_modules/@hapi/joi/lib/base.js 15: 15-34 @ ./node_modules/@hapi/joi/lib/types/any.js @ ./node_modules/@hapi/joi/lib/index.js @ ./src/services/fieldDefinitionsValidation.service.ts @ ./src/config/ioc.container.ts @ ./src/_lambda-handlers/reservationsDelete.ts

приветствуется любая помощь.

"@hapi/joi": "^16.1.7",
node : v10.16.3
...