Sign in to follow this  

babel-cli + nodejs + ragemp

Recommended Posts

I have problems connect nodejs server to ragemp.

I have error, what express 

Error: E:\Project\Rage_Server\server-files\packages\foundation\server.js:2
import express from "express";

SyntaxError: Unexpected identifier.

This is all because I can not run babel-cli
If I put in package.json main: npm start ragemp does not see js server


how do i run babel?


"use strick";
import express from "express";
const server = express();
server.listen(3000, function () {
console.log("server nodejs is started!");


"name": "GTA_V",
"version": "1.0.0",
"description": "GTA_V 1.0",
"main": "server.js",
"scripts": {
"start": "nodemon --exec babel-node server.js"
"author": "Wazthunder",
"license": "ISC",
"dependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-preset-env": "^1.7.0",
"express": "^4.16.4",
"nodemon": "^1.18.10"

Share this post

Link to post
Share on other sites
Posted (edited)

Hello, with import some expenses are not in export default so you just have to do

import * as express from 'express';

ou importer le simplement comme ça:

const express = require('express');


use your webpack to make babel transpose the code? because dependencies alone are not enough, you must also configure the project.

and also here are the types, very useful for auto-completion. :)

Edited by zoukilama

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.