0

Что не так в этой строке?

import npm {green} from 'chalk';
3
  • Попробуйте без npm: import {green} from 'chalk'; 28 апр 2021 в 17:46
  • SyntaxError: Named export 'green' not found. The requested module 'chalk' is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using: вот что выдает 28 апр 2021 в 18:17
  • Тогда попробуйте import chalk from 'chalk';, а потом используйте chalk.green(). 28 апр 2021 в 18:26

1 ответ 1

0

у меня работает так:

const chalk = require('chalk');
const log = console.log;
const error = chalk.bold.red;

 log(chalk.green.underline.bold(hashRole));

Была подобная проблема, из-за какой-то темы в VSCode.

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.