Задать вопрос

Ubuntu. Когда запускаю JS файл с помощью nodeJS (npm) выходит ошибка, скрипт не запускается. Как исправить?

Когда запускаю JS файл с помощью nodeJS (npm) выходит ошибка, скрипт не запускается. Пишу в терминале npm run start и пишется ошибка:
Debugger listening on ws://127.0.0.1:38253/2de2e801-81cc-4d33-9b1c-c059c9cbb68a
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.

> firma128.com@0.0.1 start /var/www/firma128.com
> node main.js

Debugger listening on ws://127.0.0.1:33561/ca7fdf8f-b25a-4db0-b67b-35750aefb7ae
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
/var/www/firma128.com/node_modules/currency-converter-lt/index.js:5
    currencies = {
               ^

SyntaxError: Unexpected token =
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/var/www/firma128.com/main.js:1:12)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
Waiting for the debugger to disconnect...
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! firma128.com@0.0.1 start: `node main.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the firma128.com@0.0.1 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!     /home/chebak/.npm/_logs/2023-03-20T16_51_39_035Z-debug.log
Waiting for the debugger to disconnect...

JSON:
{
  "name": "firma128.com",
  "version": "0.0.1",
  "description": "chat",
  "main": "main.js",
  "scripts": {
    "start": "node main.js"
  },
  "author": "chebak",
  "license": "ISC",
  "dependencies": {
    "currency-converter-lt": "^2.0.0-beta.0",
    "jquery": "^3.6.4"
  },
  "devDependencies": {}
}

Вот сам JS:
const CC = require('currency-converter-lt')
let currencyConverter = new CC({from:"USD", to:"JPY", amount:100})
currencyConverter.convert().then((response) => {
    console.log(response) //or do something else
})
console.log(currencyConverter)

Помогите пожалуйста.
  • Вопрос задан
  • 116 просмотров
Подписаться 1 Средний 5 комментариев
Пригласить эксперта
Ответы на вопрос 1
@fbi_agent26
тебе же треугольник на ошибку указывает, сотри равно или замени на то что там должно быть
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы