Транспортир 7 дает ошибку [ERR_REQUIRE_ESM]: необходимо использовать импорт для загрузки модуля ES - PullRequest
0 голосов
/ 06 августа 2020

Я использую Protractor 7.0.0 с nodejs 14 и получаю следующую ошибку:

[05:44:06] E/configParser - Error code: 105
[05:44:06] E/configParser - Error message: failed loading configuration file dist/out-tsc/e2e/config/protractor.conf.js
[05:44:06] E/configParser - Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /usr/src/project/dist/out-tsc/e2e/config/protractor.conf.js
require() of ES modules is not supported.
require() of /usr/src/project/dist/out-tsc/e2e/config/protractor.conf.js from /usr/src/project/node_modules/protractor/built/configParser.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename protractor.conf.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /usr/src/project/package.json.

Похоже, это потому, что node_modules/protractor/built/configParser.js использует require.

Как Могу ли я запустить Protractor, когда nodejs кажется, что против смешивания импорта и требует?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...