es6 syntax... the following code is throwing an exception.
import express from 'express';
import { API_UTILS } from '../utilities'
export class ConverseRESTAPI {
constructor(){}
main = () => {
const port = API_UTILS.PORT || process.env.PORT;
const server = express();
server.listen(port, API_UTILS.INIT(port));
}
}
const myApp = new ConverseRESTAPI();
myApp.main();
The exception :-
internal/modules/run_main.js:54
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'D:\Full Stack Development\REACT\Converse\BACKEND REST API\utilities' imported from D:\Full Stack Development\REACT\Converse\BACKEND REST API\src\app.js
Did you mean to import ../../utilities.js?
You have to require it not import
Node is yet to implement some Es6 syntax that y import might not work.. Use "require" instead or you npm install browserify to enhance d usage..
Обсуждают сегодня