idoco / intergram

Free live chat widget linked to your Telegram messenger
https://www.intergram.xyz
Mozilla Public License 2.0
1.41k stars 360 forks source link

Can't npm install my own server following installation guide #126

Closed JuanPabloMF closed 11 months ago

JuanPabloMF commented 11 months ago

So I followed as mentioned in a few issue threads the following article:

https://ictis-cz.translate.goog/telegram-chat-widget-self-hosted-debian-linux-intergram-github-skript-nodejs/?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=es-419

I did the changes to package.json and webpack.config.js, and run the different npm install --legacy-peer-deps and npm audit fix.

After running through the tutorial up to npm install terser, I am getting the following error:

npm install
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'intergram@0.0.1',
npm WARN EBADENGINE   required: { node: '6.9.1', npm: '3.10.8' },
npm WARN EBADENGINE   current: { node: 'v16.13.2', npm: '8.4.1' }
npm WARN EBADENGINE }

> intergram@0.0.1 postinstall
> npm run build

> intergram@0.0.1 build
> shx mkdir -p dist && shx cp *.html dist && shx cp -r ./media dist && shx cp -r ./css dist && webpack --mode production

assets by status 6.91 KiB [cached] 2 assets
./src/widget/widget-index.js 39 bytes [built] [code generated] [1 error]
./src/chat/chat-index.js 39 bytes [built] [code generated] [1 error]

ERROR in ./src/chat/chat-index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Plugin/Preset files are not allowed to export objects, only functions. In /home/juanpablo/intergram/node_modules/babel-preset-es2015/lib/index.js
    at createDescriptor (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-descriptors.js:160:11)
    at createDescriptor.next (<anonymous>)
    at step (/home/juanpablo/intergram/node_modules/gensync/index.js:261:32)
    at evaluateAsync (/home/juanpablo/intergram/node_modules/gensync/index.js:291:5)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:44:11
    at Array.forEach (<anonymous>)
    at Function.async (/home/juanpablo/intergram/node_modules/gensync/index.js:43:15)
    at Function.all (/home/juanpablo/intergram/node_modules/gensync/index.js:216:13)
    at Generator.next (<anonymous>)
    at createDescriptors (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-descriptors.js:102:41)
    at createDescriptors.next (<anonymous>)
    at createPresetDescriptors (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-descriptors.js:96:17)
    at createPresetDescriptors.next (<anonymous>)
    at /home/juanpablo/intergram/node_modules/@babel/core/lib/gensync-utils/functional.js:21:23
    at Generator.next (<anonymous>)
    at mergeChainOpts (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-chain.js:350:34)
    at mergeChainOpts.next (<anonymous>)
    at chainWalker (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-chain.js:316:14)
    at chainWalker.next (<anonymous>)
    at loadFileChain (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-chain.js:191:24)
    at loadFileChain.next (<anonymous>)
    at buildRootChain (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-chain.js:108:31)
    at buildRootChain.next (<anonymous>)
    at loadPrivatePartialConfig (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/partial.js:72:62)
    at loadPrivatePartialConfig.next (<anonymous>)
    at loadPartialConfig (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/partial.js:115:25)
    at loadPartialConfig.next (<anonymous>)
    at step (/home/juanpablo/intergram/node_modules/gensync/index.js:269:25)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/home/juanpablo/intergram/node_modules/gensync/index.js:223:11)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:50:45
    at step (/home/juanpablo/intergram/node_modules/gensync/index.js:287:14)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/home/juanpablo/intergram/node_modules/gensync/index.js:223:11)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:189:28
    at /home/juanpablo/intergram/node_modules/@babel/core/lib/gensync-utils/async.js:67:7
    at /home/juanpablo/intergram/node_modules/gensync/index.js:113:33
    at step (/home/juanpablo/intergram/node_modules/gensync/index.js:287:14)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/home/juanpablo/intergram/node_modules/gensync/index.js:223:11)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:189:28
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)

ERROR in ./src/widget/widget-index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Plugin/Preset files are not allowed to export objects, only functions. In /home/juanpablo/intergram/node_modules/babel-preset-es2015/lib/index.js
    at createDescriptor (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-descriptors.js:160:11)
    at createDescriptor.next (<anonymous>)
    at step (/home/juanpablo/intergram/node_modules/gensync/index.js:261:32)
    at evaluateAsync (/home/juanpablo/intergram/node_modules/gensync/index.js:291:5)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:44:11
    at Array.forEach (<anonymous>)
    at Function.async (/home/juanpablo/intergram/node_modules/gensync/index.js:43:15)
    at Function.all (/home/juanpablo/intergram/node_modules/gensync/index.js:216:13)
    at Generator.next (<anonymous>)
    at createDescriptors (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-descriptors.js:102:41)
    at createDescriptors.next (<anonymous>)
    at createPresetDescriptors (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-descriptors.js:96:17)
    at createPresetDescriptors.next (<anonymous>)
    at /home/juanpablo/intergram/node_modules/@babel/core/lib/gensync-utils/functional.js:21:23
    at Generator.next (<anonymous>)
    at mergeChainOpts (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-chain.js:350:34)
    at mergeChainOpts.next (<anonymous>)
    at chainWalker (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-chain.js:316:14)
    at chainWalker.next (<anonymous>)
    at loadFileChain (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-chain.js:191:24)
    at loadFileChain.next (<anonymous>)
    at buildRootChain (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/config-chain.js:108:31)
    at buildRootChain.next (<anonymous>)
    at loadPrivatePartialConfig (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/partial.js:72:62)
    at loadPrivatePartialConfig.next (<anonymous>)
    at loadPartialConfig (/home/juanpablo/intergram/node_modules/@babel/core/lib/config/partial.js:115:25)
    at loadPartialConfig.next (<anonymous>)
    at step (/home/juanpablo/intergram/node_modules/gensync/index.js:269:25)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/home/juanpablo/intergram/node_modules/gensync/index.js:223:11)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:50:45
    at step (/home/juanpablo/intergram/node_modules/gensync/index.js:287:14)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/home/juanpablo/intergram/node_modules/gensync/index.js:223:11)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:189:28
    at /home/juanpablo/intergram/node_modules/@babel/core/lib/gensync-utils/async.js:67:7
    at /home/juanpablo/intergram/node_modules/gensync/index.js:113:33
    at step (/home/juanpablo/intergram/node_modules/gensync/index.js:287:14)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/home/juanpablo/intergram/node_modules/gensync/index.js:223:11)
    at /home/juanpablo/intergram/node_modules/gensync/index.js:189:28
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)

webpack 5.89.0 compiled with 2 errors in 1081 ms
npm ERR! code 1
npm ERR! path /home/juanpablo/intergram
npm ERR! command failed
npm ERR! command sh -c npm run build

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-12-13T13_57_36_018Z-debug-0.log

I am using node version v16.13.2 and 8.4.1. I have also tried with the newest node version.

My package.json:

{
  "name": "intergram",
  "version": "0.0.1",
  "description": "A live chat widget linked to your telegram messenger",
  "engines": {
    "node": "6.9.1",
    "npm": "3.10.8"
  },
  "scripts": {
    "start": "node server.js",
    "postinstall": "npm run build",
    "dev": "start  http://localhost:3000/demo.html & node devServer.js",
    "build": "shx mkdir -p dist && shx cp *.html dist && shx cp -r ./media dist && shx cp -r ./css dist && webpack --mode production",
    "test": "npm run -s lint",
    "lint": "eslint src"
  },
  "authors": [
    "Ido Cohen (http://github.com/idoco)"
  ],
  "devDependencies": {
    "webpack-bundle-analyzer": "^4.10.1",
    "webpack-cli": "^5.1.4",
    "webpack-dev-server": "^4.15.1"
  },
  "dependencies": {
    "@babel/core": "^7.23.6",
    "babel-core": "^4.7.16",
    "babel-eslint": "^6.1.2",
    "babel-loader": "^9.1.3",
    "babel-plugin-transform-react-jsx": "^6.4.0",
    "babel-preset-es2015": "^6.0.15",
    "babel-preset-stage-0": "^6.0.15",
    "body-parser": "^1.15.2",
    "compression": "^1.6.2",
    "cors": "^2.8.1",
    "dateformat": "^2.0.0",
    "eslint": "^6.5.1",
    "express": "^4.18.2",
    "preact": "^7.1.0",
    "request": "^2.79.0",
    "shx": "^0.3.4",
    "socket.io": "^4.7.2",
    "socket.io-client": "^4.7.2",
    "store": "^1.3.20",
    "terser": "^5.26.0",
    "webpack": "^5.89.0"
  }
}

and my webpack.config.js:

let path = require('path');
let webpack = require('webpack');
const TerserPlugin = require("terser-webpack-plugin");

module.exports = {
    devtool: 'source-map',
    entry: {
        widget: [
            path.join(__dirname, 'src', 'widget', 'widget-index.js')
        ],
        chat: [
            path.join(__dirname, 'src', 'chat', 'chat-index.js')
        ],
    },
    output: {
        path: path.join(__dirname, 'dist', 'js'),
        filename: '[name].js',
        publicPath: '/js/'
    },
    module: {
        rules: [
            { test: /\.js$/, use: ['babel-loader'], include: path.join(__dirname, 'src') },
            { test: /\.css$/, use: ['style','css', 'sass'], include: path.join(__dirname, 'css') },
        ]
    },
    plugins: [
        new webpack.DefinePlugin({
            'process.env': {
                'NODE_ENV': JSON.stringify('production')
            }
        }),
    ],
    optimization: {
    minimize: true,
    minimizer: [new TerserPlugin()],
    },

};
JuanPabloMF commented 11 months ago

I changed all babel-* versions, avoiding a few gaps (such as babel-core 7 with babel-loader 9) and it worked.