Explore all Nodejs open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Nodejs

electron

electron v19.0.0-alpha.4

axios

v0.26.1

node

2022-04-19, Version 18.0.0 (Current), @BethGriggs

next.js

v12.1.6-canary.6

TypeScript

TypeScript 4.7 Beta

Popular Libraries in Nodejs

freeCodeCamp

by freeCodeCamp doticonjavascriptdoticon

star image 344419 doticonBSD-3-Clause

freeCodeCamp.org's open-source codebase and curriculum. Learn to code for free.

electron

by electron doticonc++doticon

star image 101364 doticonMIT

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

30-seconds-of-code

by 30-seconds doticonjavascriptdoticon

star image 92600 doticonCC-BY-4.0

Short JavaScript code snippets for all your development needs

axios

by axios doticonjavascriptdoticon

star image 92140 doticonMIT

Promise based HTTP client for the browser and node.js

node

by nodejs doticonjavascriptdoticon

star image 86998 doticonNOASSERTION

Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:

next.js

by vercel doticonjavascriptdoticon

star image 85621 doticonMIT

The React Framework

TypeScript

by microsoft doticontypescriptdoticon

star image 79882 doticonApache-2.0

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

puppeteer

by puppeteer doticontypescriptdoticon

star image 77484 doticonApache-2.0

Headless Chrome Node.js API

nodebestpractices

by goldbergyoni doticonjavascriptdoticon

star image 76719 doticonCC-BY-SA-4.0

:white_check_mark: The Node.js best practices list (March 2022)

Trending New libraries in Nodejs

zx

by google doticonjavascriptdoticon

star image 30481 doticonApache-2.0

A tool for writing better scripts

fiber

by gofiber doticongodoticon

star image 19407 doticonMIT

⚑️ Express inspired web framework written in Go

type-challenges

by type-challenges doticontypescriptdoticon

star image 16090 doticonMIT

Collection of TypeScript type challenges with online judge

dogehouse

by benawad doticontypescriptdoticon

star image 9175 doticonMIT

Taking voice conversations to the moon πŸš€

amplication

by amplication doticontypescriptdoticon

star image 7019 doticonApache-2.0

Amplication is an open‑source development tool. It helps you develop quality Node.js applications without spending time on repetitive coding tasks.

metrics

by lowlighter doticonjavascriptdoticon

star image 6292 doticonMIT

πŸ“Š An infographics generator with 30+ plugins and 200+ options to display stats about your GitHub account and render them as SVG, Markdown, PDF or JSON!

serverless-stack

by serverless-stack doticontypescriptdoticon

star image 6040 doticonMIT

πŸ’₯ SST makes it easy to build serverless apps. Set breakpoints and test your functions locally. https://serverless-stack.com

L-ink_Card

by peng-zhihui doticoncdoticon

star image 5558 doticonGPL-3.0

Smart NFC & ink-Display Card

streetmerchant

by jef doticontypescriptdoticon

star image 4794 doticonMIT

πŸ€– The world's easiest, most powerful stock checker

Top Authors in Nodejs

1

sindresorhus

398 Libraries

star icon123945

2

jonschlinkert

383 Libraries

star icon10414

3

PacktPublishing

279 Libraries

star icon6750

4

Apress

249 Libraries

star icon3144

5

microsoft

174 Libraries

star icon144734

6

IBM

152 Libraries

star icon4920

7

mafintosh

150 Libraries

star icon19486

8

substack

136 Libraries

star icon34291

9

apache

119 Libraries

star icon33103

10

Azure-Samples

116 Libraries

star icon2869

1

398 Libraries

star icon123945

2

383 Libraries

star icon10414

3

279 Libraries

star icon6750

4

249 Libraries

star icon3144

5

174 Libraries

star icon144734

6

152 Libraries

star icon4920

7

150 Libraries

star icon19486

8

136 Libraries

star icon34291

9

119 Libraries

star icon33103

10

116 Libraries

star icon2869

Trending Kits in Nodejs

No Trending Kits are available at this moment for Nodejs

Trending Discussions on Nodejs

nodejs-16 dependency issue with libuv

Getting Error on installing Truffle on windows 10 using npm install truffle -g

Uncaught ReferenceError: Buffer is not defined

Apache reverse proxy to Node - Connection refused: AH00957

Alexa - How to send image to user?

Fresh NextJS App throwing errors before any changes

How to fix this node-sass build error on Netlify?

Trying to execute "npx typescript --init" "npm ERR! could not determine executable to run"

Discord Api Valid intents must be provided for the Client

Bundler::GemNotFound: Could not find mimemagic-0.3.5 in any of the sources on Rails project with Docker

QUESTION

nodejs-16 dependency issue with libuv

Asked 2022-Mar-23 at 17:38

This is what I'm getting on my Amazon Linux 2 instance while trying to run yum update.

Do you suggest I use --skip-broken or wait until AWS rolls out a fix?

1--> Processing Dependency: libuv >= 1:1.42.0 for package: 1:nodejs-16.13.2-8.el7.x86_64
2--> Finished Dependency Resolution
3Error: Package: 1:nodejs-16.13.2-8.el7.x86_64 (epel-testing)
4           Requires: libuv >= 1:1.42.0
5           Installed: 1:libuv-1.39.0-1.amzn2.x86_64 (@amzn2-core)
6               libuv = 1:1.39.0-1.amzn2
7           Available: 1:libuv-1.23.2-1.amzn2.0.2.i686 (amzn2-core)
8               libuv = 1:1.23.2-1.amzn2.0.2
9 You could try using --skip-broken to work around the problem
10 You could try running: rpm -Va --nofiles --nodigest
11

ANSWER

Answered 2022-Feb-09 at 19:06

Yeah, plus 1 to this issue. OP, the --skip-broken flag will only temporarily fix your currently running servers though. If you're baking any new AMIs or spinning up any new EC2s with Terraform, CDK, etc, that --skip-broken flag won't work as its not available as part of the aws cloud.init script. This will cause any new AMI or EC2 creations to timeout and fail.

One potential work around is to try compiling libuv directly from source as > 1.39 sadly isn't currently available from any linux distro.

Source https://stackoverflow.com/questions/71043534

QUESTION

Getting Error on installing Truffle on windows 10 using npm install truffle -g

Asked 2022-Mar-23 at 14:45

When i tried to install truffle i got these errors :-

I have installed Node.js earlier and also i have pip installed.

1PS C:\Users\pk199\Documents> npm install -g truffle
2
3npm ERR! code 1
4npm ERR! path C:\Users\pk199\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\leveldown
5npm ERR! command failed
6npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
7npm ERR! gyp info it worked if it ends with ok
8npm ERR! gyp info using node-gyp@8.3.0
9npm ERR! gyp info using node@16.13.1 | win32 | x64
10npm ERR! gyp info find Python using Python version 3.10.1 found at "C:\Users\pk199\AppData\Local\Programs\Python\Python310\python.exe"
11npm ERR! gyp ERR! find VS
12npm ERR! gyp ERR! find VS msvs_version was set from command line or npm config
13npm ERR! gyp ERR! find VS - looking for Visual Studio version 2022
14npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
15npm ERR! gyp ERR! find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"
16npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
17npm ERR! gyp ERR! find VS looking for Visual Studio 2015
18npm ERR! gyp ERR! find VS - not found
19npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
20npm ERR! gyp ERR! find VS
21npm ERR! gyp ERR! find VS valid versions for msvs_version:
22npm ERR! gyp ERR! find VS
23npm ERR! gyp ERR! find VS **************************************************************
24npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
25npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
26npm ERR! gyp ERR! find VS For more information consult the documentation at:
27npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
28npm ERR! gyp ERR! find VS **************************************************************
29npm ERR! gyp ERR! find VS
30npm ERR! gyp ERR! configure error
31npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
32npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
33npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
34npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
35npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
36npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
37npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
38npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
39npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:404:5)
40npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
41npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
42npm ERR! gyp ERR! System Windows_NT 10.0.19044
43npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"   
44npm ERR! gyp ERR! cwd C:\Users\pk199\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\leveldown
45npm ERR! gyp ERR! node -v v16.13.1
46npm ERR! gyp ERR! node-gyp -v v8.3.0
47npm ERR! gyp ERR! not ok
48
49npm ERR! A complete log of this run can be found in:
50npm ERR!     C:\Users\pk199\AppData\Local\npm-cache\_logs\2022-01-24T15_16_27_276Z-debug.log
51

I have installed C++ Desktop development in visual studio 2022 as well but still getting this error

ANSWER

Answered 2022-Jan-26 at 17:42

Here are some references that might help:

Try installing Truffle via PowerShell in Admin mode (very important that you're in Admin mode)

You'll need to allow scripts to run as an Admin in PowerShell. To do this, here are some references in the threads in Stack Overflow:

Enable Execution of PowerShell Scripts

PowerShell Scripts

Cannot Install Truffle

I ran the command Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force in PowerShell to get this to work, but please reference the threads above before doing this.

Source https://stackoverflow.com/questions/70842716

QUESTION

Uncaught ReferenceError: Buffer is not defined

Asked 2022-Mar-17 at 15:41

Our application kept showing the error in the title. The problem is very likely related to Webpack 5 polyfill and after going through a couple of solutions:

  1. Setting fallback + install with npm
1fallback: {
2  "stream": require.resolve("stream-browserify"),
3  "buffer": require.resolve("buffer/")
4}
5
  1. Setting alias
1fallback: {
2  "stream": require.resolve("stream-browserify"),
3  "buffer": require.resolve("buffer/")
4}
5alias: {
6  "buffer": "buffer",
7  "stream": "stream-browserify"
8}
9

We are still seeing the dreadful error:

1fallback: {
2  "stream": require.resolve("stream-browserify"),
3  "buffer": require.resolve("buffer/")
4}
5alias: {
6  "buffer": "buffer",
7  "stream": "stream-browserify"
8}
9rfc6979.js:3 Uncaught ReferenceError: Buffer is not defined
10    at Object.4142 (rfc6979.js:3)
11    at r (bootstrap:19)
12    at Object.5892 (js.js:4)
13    at r (bootstrap:19)
14    at Object.4090 (bip32.js:5)
15    at r (bootstrap:19)
16    at Object.7786 (index.js:3)
17    at r (bootstrap:19)
18    at Object.1649 (MnemonicKey.js:50)
19    at r (bootstrap:19)
20

Our setup is vanilla NodeJS + TypeScript + Webpack for multi-target: node + browser. Any help would be great!

ANSWER

Answered 2021-Aug-10 at 08:15

Answering my own question. Two things helped to resolve the issue:

  1. Adding plugins section with ProviderPlugin into webpack.config.js
1fallback: {
2  "stream": require.resolve("stream-browserify"),
3  "buffer": require.resolve("buffer/")
4}
5alias: {
6  "buffer": "buffer",
7  "stream": "stream-browserify"
8}
9rfc6979.js:3 Uncaught ReferenceError: Buffer is not defined
10    at Object.4142 (rfc6979.js:3)
11    at r (bootstrap:19)
12    at Object.5892 (js.js:4)
13    at r (bootstrap:19)
14    at Object.4090 (bip32.js:5)
15    at r (bootstrap:19)
16    at Object.7786 (index.js:3)
17    at r (bootstrap:19)
18    at Object.1649 (MnemonicKey.js:50)
19    at r (bootstrap:19)
20const webpack = require('webpack');
21
22module.exports = {
23    // ...
24
25    plugins: [
26        // Work around for Buffer is undefined:
27        // https://github.com/webpack/changelog-v5/issues/10
28        new webpack.ProvidePlugin({
29            Buffer: ['buffer', 'Buffer'],
30        }),
31        new webpack.ProvidePlugin({
32            process: 'process/browser',
33        }),
34    ],
35
36
  1. Also add in resolve.fallback into webpack.config.js:
1fallback: {
2  "stream": require.resolve("stream-browserify"),
3  "buffer": require.resolve("buffer/")
4}
5alias: {
6  "buffer": "buffer",
7  "stream": "stream-browserify"
8}
9rfc6979.js:3 Uncaught ReferenceError: Buffer is not defined
10    at Object.4142 (rfc6979.js:3)
11    at r (bootstrap:19)
12    at Object.5892 (js.js:4)
13    at r (bootstrap:19)
14    at Object.4090 (bip32.js:5)
15    at r (bootstrap:19)
16    at Object.7786 (index.js:3)
17    at r (bootstrap:19)
18    at Object.1649 (MnemonicKey.js:50)
19    at r (bootstrap:19)
20const webpack = require('webpack');
21
22module.exports = {
23    // ...
24
25    plugins: [
26        // Work around for Buffer is undefined:
27        // https://github.com/webpack/changelog-v5/issues/10
28        new webpack.ProvidePlugin({
29            Buffer: ['buffer', 'Buffer'],
30        }),
31        new webpack.ProvidePlugin({
32            process: 'process/browser',
33        }),
34    ],
35
36    resolve: {
37        extensions: [ '.ts', '.js' ],
38        fallback: {
39            "stream": require.resolve("stream-browserify"),
40            "buffer": require.resolve("buffer")
41        }
42    },
43
44

Source https://stackoverflow.com/questions/68707553

QUESTION

Apache reverse proxy to Node - Connection refused: AH00957

Asked 2021-Oct-26 at 23:58

I am trying to get a brand new cloud based server working with a default version of 20.04 server ubuntu working with apache and node. The node server appears to be running without issues reporting 4006 port is open. However I believe my apache config is not. The request will hang for a very very long time. No errors are displayed in the node terminal. So the fault must lie in my apache config seeing as we are getting the below apache errors and no JS errors.

Request error after some time
1502 proxy error
2
Apache Error Log
1502 proxy error
2[Sun Oct 17 20:58:56.608793 2021] [proxy:error] [pid 1596878] (111)Connection refused: AH00957: HTTP: attempt to connect to [::1]:4006 (localhost) failed
3[Sun Oct 17 20:58:56.608909 2021] [proxy_http:error] [pid 1596878] [client 207.46.13.93:27392] AH01114: HTTP: failed to make connection to backend: localhost
4
vhost
1502 proxy error
2[Sun Oct 17 20:58:56.608793 2021] [proxy:error] [pid 1596878] (111)Connection refused: AH00957: HTTP: attempt to connect to [::1]:4006 (localhost) failed
3[Sun Oct 17 20:58:56.608909 2021] [proxy_http:error] [pid 1596878] [client 207.46.13.93:27392] AH01114: HTTP: failed to make connection to backend: localhost
4<VirtualHost IP_ADDRESS:80>
5    ServerName api.aDomain.com
6    Redirect permanent / https://api.aDomain.com/
7</VirtualHost>
8<IfModule mod_ssl.c>
9    <VirtualHost IP_ADDRESS:443>
10        ServerName api.aDomain.com
11
12        ProxyRequests on
13        LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
14        LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
15
16        ProxyPass / http://localhost:4006/
17        ProxyPassReverse / http://localhost:4006/
18    
19
20        #certificates SSL
21        SSLEngine on
22        SSLCACertificateFile /etc/ssl/api.aDomain.com/apimini.ca
23        SSLCertificateFile /etc/ssl/api.aDomain.com/apimini.crt
24        SSLCertificateKeyFile /etc/ssl/api.aDomain.com/apimini.key
25
26        ErrorLog ${APACHE_LOG_DIR}/error_api.aDomain.com.log
27        CustomLog ${APACHE_LOG_DIR}/access_api.aDomain.com.log combined
28
29    </VirtualHost>
30</IfModule>
31
terminal output
1502 proxy error
2[Sun Oct 17 20:58:56.608793 2021] [proxy:error] [pid 1596878] (111)Connection refused: AH00957: HTTP: attempt to connect to [::1]:4006 (localhost) failed
3[Sun Oct 17 20:58:56.608909 2021] [proxy_http:error] [pid 1596878] [client 207.46.13.93:27392] AH01114: HTTP: failed to make connection to backend: localhost
4<VirtualHost IP_ADDRESS:80>
5    ServerName api.aDomain.com
6    Redirect permanent / https://api.aDomain.com/
7</VirtualHost>
8<IfModule mod_ssl.c>
9    <VirtualHost IP_ADDRESS:443>
10        ServerName api.aDomain.com
11
12        ProxyRequests on
13        LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
14        LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
15
16        ProxyPass / http://localhost:4006/
17        ProxyPassReverse / http://localhost:4006/
18    
19
20        #certificates SSL
21        SSLEngine on
22        SSLCACertificateFile /etc/ssl/api.aDomain.com/apimini.ca
23        SSLCertificateFile /etc/ssl/api.aDomain.com/apimini.crt
24        SSLCertificateKeyFile /etc/ssl/api.aDomain.com/apimini.key
25
26        ErrorLog ${APACHE_LOG_DIR}/error_api.aDomain.com.log
27        CustomLog ${APACHE_LOG_DIR}/access_api.aDomain.com.log combined
28
29    </VirtualHost>
30</IfModule>
31[nodemon] 1.19.4
32[nodemon] to restart at any time, enter `rs`
33[nodemon] watching dir(s): *.*
34[nodemon] watching extensions: js,mjs,json
35[nodemon] starting `babel-node -r dotenv/config --inspect=9229 index.js`
36Debugger listening on ws://127.0.0.1:9229/c1fcf271-aea8-47ff-910e-fe5a91fce6d2
37For help, see: https://nodejs.org/en/docs/inspector
38Browserslist: caniuse-lite is outdated. Please run next command `npm update`
39πŸš€ Server ready at http://localhost:4006
40
Node server
1502 proxy error
2[Sun Oct 17 20:58:56.608793 2021] [proxy:error] [pid 1596878] (111)Connection refused: AH00957: HTTP: attempt to connect to [::1]:4006 (localhost) failed
3[Sun Oct 17 20:58:56.608909 2021] [proxy_http:error] [pid 1596878] [client 207.46.13.93:27392] AH01114: HTTP: failed to make connection to backend: localhost
4<VirtualHost IP_ADDRESS:80>
5    ServerName api.aDomain.com
6    Redirect permanent / https://api.aDomain.com/
7</VirtualHost>
8<IfModule mod_ssl.c>
9    <VirtualHost IP_ADDRESS:443>
10        ServerName api.aDomain.com
11
12        ProxyRequests on
13        LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
14        LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
15
16        ProxyPass / http://localhost:4006/
17        ProxyPassReverse / http://localhost:4006/
18    
19
20        #certificates SSL
21        SSLEngine on
22        SSLCACertificateFile /etc/ssl/api.aDomain.com/apimini.ca
23        SSLCertificateFile /etc/ssl/api.aDomain.com/apimini.crt
24        SSLCertificateKeyFile /etc/ssl/api.aDomain.com/apimini.key
25
26        ErrorLog ${APACHE_LOG_DIR}/error_api.aDomain.com.log
27        CustomLog ${APACHE_LOG_DIR}/access_api.aDomain.com.log combined
28
29    </VirtualHost>
30</IfModule>
31[nodemon] 1.19.4
32[nodemon] to restart at any time, enter `rs`
33[nodemon] watching dir(s): *.*
34[nodemon] watching extensions: js,mjs,json
35[nodemon] starting `babel-node -r dotenv/config --inspect=9229 index.js`
36Debugger listening on ws://127.0.0.1:9229/c1fcf271-aea8-47ff-910e-fe5a91fce6d2
37For help, see: https://nodejs.org/en/docs/inspector
38Browserslist: caniuse-lite is outdated. Please run next command `npm update`
39πŸš€ Server ready at http://localhost:4006
40import cors from 'cors'
41
42import scrape from './src/api/routes/scrape'
43
44const express = require('express')
45const { ApolloServer, gql } = require('apollo-server-express')
46const { postgraphile } = require('postgraphile')
47const ConnectionFilterPlugin = require('postgraphile-plugin-connection-filter')
48
49const dbHost = process.env.DB_HOST
50const dbPort = process.env.DB_PORT
51const dbName = process.env.DB_NAME
52const dbUser = process.env.DB_USER
53const dbPwd = process.env.DB_PWD
54const dbUrl = dbPwd
55  ? `postgres://${dbUser}:${dbPwd}@${dbHost}:${dbPort}/${dbName}`
56  : `postgres://${dbHost}:${dbPort}/${dbName}`
57
58var corsOptions = {
59  origin: '*',
60  optionsSuccessStatus: 200, // some legacy browsers (IE11, various SmartTVs) choke on 204
61}
62
63async function main() {
64  // Construct a schema, using GraphQL schema language
65  const typeDefs = gql`
66    type Query {
67      hello: String
68    }
69  `
70
71  // Provide resolver functions for your schema fields
72  const resolvers = {
73    Query: {
74      hello: () => 'Hello world!',
75    },
76  }
77
78  const server = new ApolloServer({ typeDefs, resolvers })
79
80  const app = express()
81  app.use(cors(corsOptions))
82  app.use(
83    postgraphile(process.env.DATABASE_URL || dbUrl, 'public', {
84      appendPlugins: [ConnectionFilterPlugin],
85      watchPg: true,
86      graphiql: true,
87      enhanceGraphiql: true,
88    })
89  )
90  server.applyMiddleware({ app })
91
92  //Scraping Tools
93  scrape(app)
94
95  const port = 4006
96  await app.listen({ port })
97  console.log(`πŸš€ Server ready at http://localhost:${port}`)
98}
99
100main().catch(e => {
101  console.error(e)
102  process.exit(1)
103})
104
Apache Mods Enabled

/etc/apache2/mods-enabled/proxy.conf /etc/apache2/mods-enabled/proxy.load /etc/apache2/mods-enabled/proxy_http.load

Updated Error Logs
1502 proxy error
2[Sun Oct 17 20:58:56.608793 2021] [proxy:error] [pid 1596878] (111)Connection refused: AH00957: HTTP: attempt to connect to [::1]:4006 (localhost) failed
3[Sun Oct 17 20:58:56.608909 2021] [proxy_http:error] [pid 1596878] [client 207.46.13.93:27392] AH01114: HTTP: failed to make connection to backend: localhost
4<VirtualHost IP_ADDRESS:80>
5    ServerName api.aDomain.com
6    Redirect permanent / https://api.aDomain.com/
7</VirtualHost>
8<IfModule mod_ssl.c>
9    <VirtualHost IP_ADDRESS:443>
10        ServerName api.aDomain.com
11
12        ProxyRequests on
13        LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
14        LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
15
16        ProxyPass / http://localhost:4006/
17        ProxyPassReverse / http://localhost:4006/
18    
19
20        #certificates SSL
21        SSLEngine on
22        SSLCACertificateFile /etc/ssl/api.aDomain.com/apimini.ca
23        SSLCertificateFile /etc/ssl/api.aDomain.com/apimini.crt
24        SSLCertificateKeyFile /etc/ssl/api.aDomain.com/apimini.key
25
26        ErrorLog ${APACHE_LOG_DIR}/error_api.aDomain.com.log
27        CustomLog ${APACHE_LOG_DIR}/access_api.aDomain.com.log combined
28
29    </VirtualHost>
30</IfModule>
31[nodemon] 1.19.4
32[nodemon] to restart at any time, enter `rs`
33[nodemon] watching dir(s): *.*
34[nodemon] watching extensions: js,mjs,json
35[nodemon] starting `babel-node -r dotenv/config --inspect=9229 index.js`
36Debugger listening on ws://127.0.0.1:9229/c1fcf271-aea8-47ff-910e-fe5a91fce6d2
37For help, see: https://nodejs.org/en/docs/inspector
38Browserslist: caniuse-lite is outdated. Please run next command `npm update`
39πŸš€ Server ready at http://localhost:4006
40import cors from 'cors'
41
42import scrape from './src/api/routes/scrape'
43
44const express = require('express')
45const { ApolloServer, gql } = require('apollo-server-express')
46const { postgraphile } = require('postgraphile')
47const ConnectionFilterPlugin = require('postgraphile-plugin-connection-filter')
48
49const dbHost = process.env.DB_HOST
50const dbPort = process.env.DB_PORT
51const dbName = process.env.DB_NAME
52const dbUser = process.env.DB_USER
53const dbPwd = process.env.DB_PWD
54const dbUrl = dbPwd
55  ? `postgres://${dbUser}:${dbPwd}@${dbHost}:${dbPort}/${dbName}`
56  : `postgres://${dbHost}:${dbPort}/${dbName}`
57
58var corsOptions = {
59  origin: '*',
60  optionsSuccessStatus: 200, // some legacy browsers (IE11, various SmartTVs) choke on 204
61}
62
63async function main() {
64  // Construct a schema, using GraphQL schema language
65  const typeDefs = gql`
66    type Query {
67      hello: String
68    }
69  `
70
71  // Provide resolver functions for your schema fields
72  const resolvers = {
73    Query: {
74      hello: () => 'Hello world!',
75    },
76  }
77
78  const server = new ApolloServer({ typeDefs, resolvers })
79
80  const app = express()
81  app.use(cors(corsOptions))
82  app.use(
83    postgraphile(process.env.DATABASE_URL || dbUrl, 'public', {
84      appendPlugins: [ConnectionFilterPlugin],
85      watchPg: true,
86      graphiql: true,
87      enhanceGraphiql: true,
88    })
89  )
90  server.applyMiddleware({ app })
91
92  //Scraping Tools
93  scrape(app)
94
95  const port = 4006
96  await app.listen({ port })
97  console.log(`πŸš€ Server ready at http://localhost:${port}`)
98}
99
100main().catch(e => {
101  console.error(e)
102  process.exit(1)
103})
104[Thu Oct 21 10:59:22.560608 2021] [proxy_http:error] [pid 10273] (70007)The timeout specified has expired: [client 93.115.195.232:8963] AH01102: error reading status line from remote server 127.0.0.1:4006, referer: https://miniatureawards.com/
105[Thu Oct 21 10:59:22.560691 2021] [proxy:error] [pid 10273] [client 93.115.195.232:8963] AH00898: Error reading from remote server returned by /graphql, referer: https://miniatureawards.com/
106

ANSWER

Answered 2021-Oct-20 at 23:51

If you use a docker for your node server, then it might be set up incorrectly

Source https://stackoverflow.com/questions/69609078

QUESTION

Alexa - How to send image to user?

Asked 2021-Sep-30 at 10:32

I'm using a Lambda function for my Alexa Skill. For my launch intent, I query DynamoDB and return a String that I first want to convert into a QRCode and then I want to return it to the Alexa Device as an Image inside the responseBuilder

Alexa works fine displaying images from external urls such as

const rabbitImage = "https://i.imgur.com/U6eF0oH.jpeg";

1return responseBuilder
2        .speak(say)
3        .withStandardCard("Welcome to Alexa", "description", rabbitImage, rabbitImage)
4        .reprompt('try again, ' + say)
5        .getResponse();
6

But I'm stuck on how to send the QRCode back to the Alexa Device in the responseBuilder.

I'm using a nodejs library called qrcode that can convert the String into a QRCode and then into base64.

https://www.npmjs.com/package/qrcode

But according to the Alexa docs for sending a "card" aka image, back to the user it has to be a url.

https://developer.amazon.com/en-US/docs/alexa/custom-skills/include-a-card-in-your-skills-response.html

1return responseBuilder
2        .speak(say)
3        .withStandardCard("Welcome to Alexa", "description", rabbitImage, rabbitImage)
4        .reprompt('try again, ' + say)
5        .getResponse();
6The Alexa Skills Kit provides different types of cards:
7
8A Standard card also displays plain text, but can include an image. You provide the text for the title and content, and the URL for the image to display.
9

So I'm not sure if the base64 generated by the qrcode library would work in this case.

What's the best way to send the dynamically generated QRCode back to the Alexa Device as a response in this scenario?

1return responseBuilder
2        .speak(say)
3        .withStandardCard("Welcome to Alexa", "description", rabbitImage, rabbitImage)
4        .reprompt('try again, ' + say)
5        .getResponse();
6The Alexa Skills Kit provides different types of cards:
7
8A Standard card also displays plain text, but can include an image. You provide the text for the title and content, and the URL for the image to display.
9const LaunchRequest_Handler = {
10    canHandle(handlerInput) {
11      const request = handlerInput.requestEnvelope.request;
12      return request.type === 'LaunchRequest';
13    },
14    handle(handlerInput) {
15      const responseBuilder = handlerInput.responseBuilder;
16
17
18      //Perform query to DynamoDB
19
20      var stringToCreateQRWith = "8306e21d-0c9e-4465-91e9-0cf86fca110d";
21
22      //Generate qr code and send back to user here
23      //???Unsure how to do and what format to send it in
24      var qrImageToSendToUser = ???
25
26      return responseBuilder
27        .speak(say)
28        .withStandardCard("Welcome to Alexa", "description", qrImageToSendToUser , qrImageToSendToUser )
29        .reprompt('try again, ' + say)
30        .getResponse();
31
32    }
33
34

ANSWER

Answered 2021-Sep-30 at 10:32

As @kopaka proposed, this is the way to go. There is no way around it.

As per the documentation

They are a few thing you need to have in mind.

On the images itself, you will want to create 2 images with 720px x 480px and 1200px x 800px. To make sure they display nicely on multiple screen size. Otherwise they do not guarantee the best experience for your user, as they may scale up/down the image to fit.

On the storage choice, you need to make sure to be able to serve those images via Https and with a valid ssl certificate trusted by amazon.

Source https://stackoverflow.com/questions/69230838

QUESTION

Fresh NextJS App throwing errors before any changes

Asked 2021-Sep-23 at 21:49

I literally did "npx create-next-app", cd appfolder, npm run dev, and it's blowing out errors already:

1(node:7636) [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API
2(Use `node --trace-deprecation ...` to show where the warning was created)
3error - ./styles/globals.css
4Global CSS cannot be imported from files other than your Custom <App>. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
5Read more: https://nextjs.org/docs/messages/css-global
6Location: pages\_app.js
7
8Module list:
9+-- eslint-config-next@11.1.1
10+-- eslint@7.32.0
11+-- next@11.1.1
12+-- react-dom@17.0.2
13`-- react@17.0.2
14
15node -v = v14.17.5
16

So a virgin npx create-next-app, and it can't even stand up on it's own. I'm very new to NextJS / NodeJS, but not new to programming, IT, web development. Shouldn't this be able to start without blowing up before I even change anything???

ANSWER

Answered 2021-Aug-31 at 02:18

I was experiencing the exact same issue as you described, and for what I’ve found, it seems to be due to a breaking change in next@11.1.1 which is only affecting Windows.

Until this gets fixed, you can downgrade Next to version 11.1.0:

npm install next@11.1.0

yarn add next@11.1.0

Source https://stackoverflow.com/questions/68991702

QUESTION

How to fix this node-sass build error on Netlify?

Asked 2021-Sep-06 at 14:57

I've done this many times in the past, I'm getting this error in the netlify logs. The repo I am attempting to deploy is https://github.com/yanyamz/Key_Visual_Arts.

I checked to see if it was within size limitations of Netlify and it is, totally 15mb or so vs the 20+mb that you can deploy on netlify.

112:03:03 PM: Build ready to start
212:03:04 PM: build-image version: fa439ad1ab9393b2c0d449d8d7c033927683f4b0
312:03:04 PM: build-image tag: v4.3.0
412:03:04 PM: buildbot version: 0f2f658d862cfe72bae7cc05c6a8de0426a5a0e2
512:03:04 PM: Fetching cached dependencies
612:03:05 PM: Failed to fetch cache, continuing with build
712:03:05 PM: Starting to prepare the repo for build
812:03:05 PM: No cached dependencies found. Cloning fresh repo
912:03:05 PM: git clone https://github.com/yanyamz/Key_Visual_Arts
1012:03:07 PM: Preparing Git Reference refs/heads/main
1112:03:07 PM: Parsing package.json dependencies
1212:03:08 PM: 
13​
14❯ Initial build environment
15baseRelDir: true
16branch: main
17context: production
18cwd: /opt/build/repo
19featureFlags: []
20mode: buildbot
21repositoryRoot: /opt/build/repo
22siteId: 9cc686ee-a337-4ebf-886c-99acf9adfe45
23​
24❯ UI build settings
25baseRelDir: true
26build:
27  command: npm run build
28  environment:
29    - NETLIFY_BUILD_DEBUG
30  publish: dist
31​
32❯ Resolved build environment
33branch: main
34buildDir: /opt/build/repo
35context: production
36env: []
37​
38❯ Resolved config
39build:
40  command: npm run build
41  commandOrigin: ui
42  environment:
43    - NETLIFY_BUILD_DEBUG
44  publish: /opt/build/repo/dist
45  publishOrigin: ui
46
4712:03:08 PM: Starting build script
4812:03:08 PM: Installing dependencies
4912:03:08 PM: Python version set to 2.7
5012:03:09 PM: Downloading and installing node v16.8.0...
5112:03:09 PM: Downloading https://nodejs.org/dist/v16.8.0/node-v16.8.0-linux-x64.tar.xz...
5212:03:09 PM: Computing checksum with sha256sum
5312:03:09 PM: Checksums matched!
5412:03:12 PM: Now using node v16.8.0 (npm v7.21.0)
5512:03:12 PM: Started restoring cached build plugins
5612:03:12 PM: Finished restoring cached build plugins
5712:03:12 PM: Attempting ruby version 2.7.2, read from environment
5812:03:13 PM: Using ruby version 2.7.2
5912:03:14 PM: Using PHP version 8.0
6012:03:14 PM: Started restoring cached node modules
6112:03:14 PM: Finished restoring cached node modules
6212:03:14 PM: Installing NPM modules using NPM version 7.21.0
6312:03:16 PM: npm WARN old lockfile
6412:03:16 PM: npm WARN old lockfile The package-lock.json file was created with an old version of npm,
6512:03:16 PM: npm WARN old lockfile so supplemental metadata must be fetched from the registry.
6612:03:16 PM: npm WARN old lockfile
6712:03:16 PM: npm WARN old lockfile This is a one-time fix-up, please be patient...
6812:03:16 PM: npm WARN old lockfile
6912:03:18 PM: npm WARN old lockfile vue-loader-v16: No matching version found for vue-loader-v16@16.5.0.
7012:03:18 PM: npm WARN old lockfile     at module.exports (/opt/buildhome/.nvm/versions/node/v16.8.0/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:209:23)
7112:03:18 PM: npm WARN old lockfile     at /opt/buildhome/.nvm/versions/node/v16.8.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:118:26
7212:03:18 PM: npm WARN old lockfile     at async Array.<anonymous> (/opt/buildhome/.nvm/versions/node/v16.8.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:691:9)
7312:03:18 PM: npm WARN old lockfile  Could not fetch metadata for vue-loader-v16@16.5.0 vue-loader-v16: No matching version found for vue-loader-v16@16.5.0.
7412:03:18 PM: npm WARN old lockfile     at module.exports (/opt/buildhome/.nvm/versions/node/v16.8.0/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:209:23)
7512:03:18 PM: npm WARN old lockfile     at /opt/buildhome/.nvm/versions/node/v16.8.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:118:26
7612:03:18 PM: npm WARN old lockfile     at async Array.<anonymous> (/opt/buildhome/.nvm/versions/node/v16.8.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:691:9) {
7712:03:18 PM: npm WARN old lockfile   code: 'ETARGET',
7812:03:18 PM: npm WARN old lockfile   type: 'version',
7912:03:18 PM: npm WARN old lockfile   wanted: '16.5.0',
8012:03:18 PM: npm WARN old lockfile   versions: [
8112:03:18 PM: npm WARN old lockfile     '16.0.0-beta.5',
8212:03:18 PM: npm WARN old lockfile     '16.0.0-beta.5.1',
8312:03:18 PM: npm WARN old lockfile     '16.0.0-beta.5.2',
8412:03:18 PM: npm WARN old lockfile     '16.0.0-beta.5.3',
8512:03:18 PM: npm WARN old lockfile     '16.0.0-beta.5.4'
8612:03:18 PM: npm WARN old lockfile   ],
8712:03:18 PM: npm WARN old lockfile   distTags: { latest: '16.0.0-beta.5.4' },
8812:03:18 PM: npm WARN old lockfile   defaultTag: 'latest'
8912:03:18 PM: npm WARN old lockfile }
9012:03:33 PM: npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
9112:03:33 PM: npm WARN deprecated har-validator@5.1.5: this library is no longer supported
9212:03:33 PM: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
9312:03:34 PM: npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
9412:03:35 PM: npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
9512:03:37 PM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
9612:03:38 PM: npm WARN deprecated eslint-loader@2.2.1: This loader has been deprecated. Please use eslint-webpack-plugin
9712:03:39 PM: npm WARN deprecated html-webpack-plugin@3.2.0: 3.x is no longer supported
9812:03:40 PM: npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
9912:03:40 PM: npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
10012:03:40 PM: npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
10112:03:41 PM: npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
10212:03:42 PM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
10312:03:42 PM: npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
10412:03:42 PM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
10512:03:43 PM: npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
10612:03:43 PM: npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
10712:06:00 PM: npm ERR! code 1
10812:06:00 PM: npm ERR! path /opt/build/repo/node_modules/node-sass
10912:06:00 PM: npm ERR! command failed
11012:06:00 PM: npm ERR! command sh -c node scripts/build.js
11112:06:00 PM: npm ERR! Building: /opt/buildhome/.nvm/versions/node/v16.8.0/bin/node /opt/build/repo/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
11212:06:00 PM: npm ERR! make: Entering directory '/opt/build/repo/node_modules/node-sass/build'
11312:06:00 PM: npm ERR!   g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' 
114

ANSWER

Answered 2021-Aug-29 at 19:53

Stop using node-sass

  1. it is native node package, which means it requires some build tools to be installed in some environments (prebuild binaries for some OS/environments are distributed in NPM package but obviously not for one used by netlify)

  2. On top of that it is already deprecated

Just uninstall node-sass and install sass - sass-loader should switch to it automatically

Source https://stackoverflow.com/questions/68976148

QUESTION

Trying to execute "npx typescript --init" "npm ERR! could not determine executable to run"

Asked 2021-Sep-04 at 20:40

What does the error npm ERR! could not determine executable to run mean?

I'm trying to initialise a simple nodejs app with typescript and yarn. I've never really used yarn before.

I've ran the commands: yarn init Which successfully creates a package.json npx typescript --init Gives me the above error message.

Versions: yarn v1.22.11 npx 7.12.0

I've ran yarn add typescript and it gives me:

1info Direct dependencies
2└─ typescript@4.3.5
3info All dependencies
4└─ typescript@4.3.5
5

But when I try typescript -v I get typescript: command not found

ANSWER

Answered 2021-Aug-20 at 10:02

The fix was to use the command npx tsc --init.

I don't know why the tutorial I was following used npx typescript --init, but it worked for them and not for me.

Source https://stackoverflow.com/questions/68858910

QUESTION

Discord Api Valid intents must be provided for the Client

Asked 2021-Aug-08 at 14:33

I am programming a discord bot. When I try to run node. in the cmd I get this:

C:\Users\utente\Desktop\bouncerBot\node_modules\discord.js\src\client\Client.js:544 throw new TypeError('CLIENT_MISSING_INTENTS'); ^

TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client. at Client._validateOptions (C:\Users\utente\Desktop\bouncerBot\node_modules\←[4mdiscord.js←[24m\src\client\Client.js:544:13) at new Client (C:\Users\utente\Desktop\bouncerBot\node_modules\←[4mdiscord.js←[24m\src\client\Client.js:73:10) at Object. (C:\Users\utente\Desktop\bouncerBot\main.js:2:16) ←[90m at Module._compile (internal/modules/cjs/loader.js:1072:14)←[39m ←[90m
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)←[39m ←[90m at Module.load (internal/modules/cjs/loader.js:937:32)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:778:12)←[39m ←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)←[39m ←[90m at internal/main/run_main_module.js:17:47←[39m {
[←[32mSymbol(code)←[39m]: ←[32m'CLIENT_MISSING_INTENTS'←[39m }

C:\Users\utente\Desktop\bouncerBot>node . C:\Users\utente\Desktop\bouncerBot\node_modules\discord.js\src\client\Client.js:544 throw new TypeError('CLIENT_MISSING_INTENTS'); ^

TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client. at Client._validateOptions (C:\Users\utente\Desktop\bouncerBot\node_modules\←[4mdiscord.js←[24m\src\client\Client.js:544:13) at new Client (C:\Users\utente\Desktop\bouncerBot\node_modules\←[4mdiscord.js←[24m\src\client\Client.js:73:10) at Object. (C:\Users\utente\Desktop\bouncerBot\main.js:3:16) ←[90m at Module._compile (internal/modules/cjs/loader.js:1072:14)←[39m ←[90m
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)←[39m ←[90m at Module.load (internal/modules/cjs/loader.js:937:32)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:778:12)←[39m ←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)←[39m ←[90m at internal/main/run_main_module.js:17:47←[39m {
[←[32mSymbol(code)←[39m]: ←[32m'CLIENT_MISSING_INTENTS'←[39m

I tried to search online for solutions but found nothing. I also activated the following potions in the bot settings but nothing changes:

enter image description here

This is my code, even if it is not the cause of the error:

Main.js:

1   const Discord = require('discord.js');
2    const fs = require('fs');
3    const client = new Discord.Client();
4    
5    let rawdata = fs.readFileSync('config.json');
6    let config = JSON.parse(rawdata);
7    
8    const TOKEN = config.botToken
9    const prefix = config.prefix
10    
11    client.login(TOKEN)
12    client.on('message', message => {
13        if (!message.content.startsWith(prefix) || message.author.bot) return;
14        const args = message.content.slice(prefix.lenght).split(/ +/)
15        const command = args[1].toLowerCase()
16        console.log(args)
17        //Command test!
18    })
19    
20    client.once('ready', () => {
21        console.log("Discord bot online")
22    
23    });
24

config.json:

1   const Discord = require('discord.js');
2    const fs = require('fs');
3    const client = new Discord.Client();
4    
5    let rawdata = fs.readFileSync('config.json');
6    let config = JSON.parse(rawdata);
7    
8    const TOKEN = config.botToken
9    const prefix = config.prefix
10    
11    client.login(TOKEN)
12    client.on('message', message => {
13        if (!message.content.startsWith(prefix) || message.author.bot) return;
14        const args = message.content.slice(prefix.lenght).split(/ +/)
15        const command = args[1].toLowerCase()
16        console.log(args)
17        //Command test!
18    })
19    
20    client.once('ready', () => {
21        console.log("Discord bot online")
22    
23    });
24{
25    "botToken":"",
26    "prefix":"!pgc"
27}
28

Edit:

I tried to update the code as follows:

1   const Discord = require('discord.js');
2    const fs = require('fs');
3    const client = new Discord.Client();
4    
5    let rawdata = fs.readFileSync('config.json');
6    let config = JSON.parse(rawdata);
7    
8    const TOKEN = config.botToken
9    const prefix = config.prefix
10    
11    client.login(TOKEN)
12    client.on('message', message => {
13        if (!message.content.startsWith(prefix) || message.author.bot) return;
14        const args = message.content.slice(prefix.lenght).split(/ +/)
15        const command = args[1].toLowerCase()
16        console.log(args)
17        //Command test!
18    })
19    
20    client.once('ready', () => {
21        console.log("Discord bot online")
22    
23    });
24{
25    "botToken":"",
26    "prefix":"!pgc"
27}
28    const Discord = require('discord.js');
29    const fs = require('fs');
30    
31    const { Client, Intents } = require('discord.js');
32    
33    const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
34    
35    let rawdata = fs.readFileSync('config.json');
36    let config = JSON.parse(rawdata);
37    
38    const TOKEN = config.botToken
39    const prefix = config.prefix
40    
41    
42    client.on('message', message => {
43        if (!message.content.startsWith(prefix) || message.author.bot) return;
44        const args = message.content.slice(prefix.lenght).split(/ +/)
45        const command = args[1].toLowerCase()
46        console.log(args)
47        //Command test!
48    })
49    
50    client.once('ready', () => {
51        console.log("Discord bot online")
52    
53    });
54client.login(TOKEN)
55

But I still get an error:

(node:12216) UnhandledPromiseRejectionWarning: ReferenceError: AbortController is not defined at RequestHandler.execute (C:\Users\utente\Desktop\bouncerBot\node_modules\discord.js\src\rest\RequestHandler.js:172:15) at RequestHandler.execute (C:\Users\utente\Desktop\bouncerBot\node_modules\discord.js\src\rest\RequestHandler.js:176:19) at RequestHandler.push (C:\Users\utente\Desktop\bouncerBot\node_modules\discord.js\src\rest\RequestHandler.js:50:25) at async WebSocketManager.connect (C:\Users\utente\Desktop\bouncerBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:128:9) at async Client.login (C:\Users\utente\Desktop\bouncerBot\node_modules\discord.js\src\client\Client.js:245:7) (Use node --trace-warnings ... to show where the warning was created) (node:12216) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:12216) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

ANSWER

Answered 2021-Aug-08 at 14:02

First of all, never show a token of your bot, or try to change it later.

Second of all:

Try using this. Since new updated of discord.js like version ^13.0 you have to specify client intents:

1   const Discord = require('discord.js');
2    const fs = require('fs');
3    const client = new Discord.Client();
4    
5    let rawdata = fs.readFileSync('config.json');
6    let config = JSON.parse(rawdata);
7    
8    const TOKEN = config.botToken
9    const prefix = config.prefix
10    
11    client.login(TOKEN)
12    client.on('message', message => {
13        if (!message.content.startsWith(prefix) || message.author.bot) return;
14        const args = message.content.slice(prefix.lenght).split(/ +/)
15        const command = args[1].toLowerCase()
16        console.log(args)
17        //Command test!
18    })
19    
20    client.once('ready', () => {
21        console.log("Discord bot online")
22    
23    });
24{
25    "botToken":"",
26    "prefix":"!pgc"
27}
28    const Discord = require('discord.js');
29    const fs = require('fs');
30    
31    const { Client, Intents } = require('discord.js');
32    
33    const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
34    
35    let rawdata = fs.readFileSync('config.json');
36    let config = JSON.parse(rawdata);
37    
38    const TOKEN = config.botToken
39    const prefix = config.prefix
40    
41    
42    client.on('message', message => {
43        if (!message.content.startsWith(prefix) || message.author.bot) return;
44        const args = message.content.slice(prefix.lenght).split(/ +/)
45        const command = args[1].toLowerCase()
46        console.log(args)
47        //Command test!
48    })
49    
50    client.once('ready', () => {
51        console.log("Discord bot online")
52    
53    });
54client.login(TOKEN)
55const { Client, Intents } = require('discord.js');
56
57const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
58

And obviously, put client.login(TOKEN) at the very bottom.

For more updates required from new version of discord.js click here

Source https://stackoverflow.com/questions/68701446

QUESTION

Bundler::GemNotFound: Could not find mimemagic-0.3.5 in any of the sources on Rails project with Docker

Asked 2021-Jun-10 at 00:24

I'm aware of the recent mimemagic issues, which I managed to resolve on one of my Rails projects by bundle updating to 0.3.7 - but for some reason, I can't resolve it on the project below.

I have a Rails 6 project which I'm setting up for the first time on a new laptop. My laptop doesn't have the correct Ruby setup, so I've added a Dockerfile to my project like so:-

Dockerfile

1FROM ruby:2.7
2RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
3WORKDIR /radius
4COPY Gemfile /myapp/Gemfile
5COPY Gemfile.lock /myapp/Gemfile.lock
6RUN bundle update mimemagic
7RUN bundle install
8COPY . /myapp
9
10
11COPY entrypoint.sh /usr/bin/
12RUN chmod +x /usr/bin/entrypoint.sh
13ENTRYPOINT ["entrypoint.sh"]
14EXPOSE 3000
15
16
17CMD ["rails", "server", "-b", "0.0.0.0"]
18

Gemfile

1FROM ruby:2.7
2RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
3WORKDIR /radius
4COPY Gemfile /myapp/Gemfile
5COPY Gemfile.lock /myapp/Gemfile.lock
6RUN bundle update mimemagic
7RUN bundle install
8COPY . /myapp
9
10
11COPY entrypoint.sh /usr/bin/
12RUN chmod +x /usr/bin/entrypoint.sh
13ENTRYPOINT ["entrypoint.sh"]
14EXPOSE 3000
15
16
17CMD ["rails", "server", "-b", "0.0.0.0"]
18# frozen_string_literal: true
19
20source 'https://rubygems.org'
21git_source(:github) { |repo| "https://github.com/#{repo}.git" }
22
23ruby '2.7.2'
24gem 'airbrake'
25
26# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
27gem 'dotenv-rails'
28gem 'rails', '~> 6.0.3.6'
29# Use postgresql as the database for Active Record
30gem 'pg', '>= 0.18', '< 2.0'
31# Use Puma as the app server
32gem 'puma', '~> 3.11'
33# Use SCSS for stylesheets
34gem 'sass-rails', '~> 5'
35gem 'shortener'
36
37# Use Honeybadger for error reporting/monitoring
38gem 'honeybadger', '~> 4.0'
39# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
40gem 'webpacker', '~> 4.0'
41# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
42gem 'turbolinks', '~> 5'
43# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
44gem 'jbuilder', '~> 2.5'
45# Use Redis adapter to run Action Cable in production
46# gem 'redis', '~> 4.0'
47# Use Active Model has_secure_password
48# gem 'bcrypt', '~> 3.1.7'
49gem 'newrelic_rpm'
50
51# Use Active Storage variant
52# gem 'image_processing', '~> 1.2'
53
54# Reduces boot times through caching; required in config/boot.rb
55gem 'bootsnap', '>= 1.4.2', require: false
56
57group :development, :test do
58  gem 'awesome_print'
59  gem 'byebug', platforms: %i[mri mingw x64_mingw]
60  gem 'pry-byebug'
61  # Version specified as workaround for this issue https://github.com/rails/rails/issues/35417
62  gem 'rspec-rails', '~> 4.0.0.beta2'
63end
64
65group :development do
66  gem 'factory_bot_rails', '~> 4.0'
67  gem 'fasterer'
68  gem 'haml_lint', require: false
69  gem 'listen', '>= 3.0.5', '< 3.2'
70  gem 'rails_best_practices'
71  gem 'reek'
72  gem 'rubocop'
73  gem 'scss_lint', require: false
74  gem 'spring'
75  gem 'spring-watcher-listen', '~> 2.0.0'
76  gem 'web-console', '>= 3.3.0'
77end
78
79group :test do
80  # Adds support for Capybara system testing and selenium driver
81  gem 'capybara', '>= 2.15'
82  gem 'rspec_junit_formatter'
83  gem 'selenium-webdriver'
84  # Easy installation and use of web drivers to run system tests with browsers
85  gem 'webdrivers'
86  gem 'webmock'
87end
88
89# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
90gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
91
92gem 'administrate', '0.12.0'
93gem 'bootstrap', '~> 4.3', '>= 4.3.1'
94gem 'devise', '~> 4.6', '>= 4.6.1'
95gem 'devise-bootstrapped',  github: 'excid3/devise-bootstrapped',
96                            branch: 'bootstrap4'
97gem 'devise_masquerade', '~> 0.6.2'
98gem 'font-awesome-sass', '~> 5.6', '>= 5.6.1'
99gem 'friendly_id', '~> 5.2', '>= 5.2.5'
100gem 'gibbon'
101gem 'gmaps4rails'
102gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag'
103gem 'httparty'
104gem 'mini_magick', '~> 4.9', '>= 4.9.2'
105gem 'name_of_person', '~> 1.1'
106gem 'omniauth-facebook', '~> 5.0'
107gem 'omniauth-github', '~> 1.3'
108gem 'omniauth-twitter', '~> 1.4'
109gem 'pundit', '~> 1.1.0'
110gem 'sidekiq', '~> 5.2', '>= 5.2.5'
111gem 'sitemap_generator', '~> 6.0', '>= 6.0.1'
112gem 'underscore-rails'
113gem 'whenever', require: false
114
115

I then try:-

1FROM ruby:2.7
2RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
3WORKDIR /radius
4COPY Gemfile /myapp/Gemfile
5COPY Gemfile.lock /myapp/Gemfile.lock
6RUN bundle update mimemagic
7RUN bundle install
8COPY . /myapp
9
10
11COPY entrypoint.sh /usr/bin/
12RUN chmod +x /usr/bin/entrypoint.sh
13ENTRYPOINT ["entrypoint.sh"]
14EXPOSE 3000
15
16
17CMD ["rails", "server", "-b", "0.0.0.0"]
18# frozen_string_literal: true
19
20source 'https://rubygems.org'
21git_source(:github) { |repo| "https://github.com/#{repo}.git" }
22
23ruby '2.7.2'
24gem 'airbrake'
25
26# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
27gem 'dotenv-rails'
28gem 'rails', '~> 6.0.3.6'
29# Use postgresql as the database for Active Record
30gem 'pg', '>= 0.18', '< 2.0'
31# Use Puma as the app server
32gem 'puma', '~> 3.11'
33# Use SCSS for stylesheets
34gem 'sass-rails', '~> 5'
35gem 'shortener'
36
37# Use Honeybadger for error reporting/monitoring
38gem 'honeybadger', '~> 4.0'
39# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
40gem 'webpacker', '~> 4.0'
41# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
42gem 'turbolinks', '~> 5'
43# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
44gem 'jbuilder', '~> 2.5'
45# Use Redis adapter to run Action Cable in production
46# gem 'redis', '~> 4.0'
47# Use Active Model has_secure_password
48# gem 'bcrypt', '~> 3.1.7'
49gem 'newrelic_rpm'
50
51# Use Active Storage variant
52# gem 'image_processing', '~> 1.2'
53
54# Reduces boot times through caching; required in config/boot.rb
55gem 'bootsnap', '>= 1.4.2', require: false
56
57group :development, :test do
58  gem 'awesome_print'
59  gem 'byebug', platforms: %i[mri mingw x64_mingw]
60  gem 'pry-byebug'
61  # Version specified as workaround for this issue https://github.com/rails/rails/issues/35417
62  gem 'rspec-rails', '~> 4.0.0.beta2'
63end
64
65group :development do
66  gem 'factory_bot_rails', '~> 4.0'
67  gem 'fasterer'
68  gem 'haml_lint', require: false
69  gem 'listen', '>= 3.0.5', '< 3.2'
70  gem 'rails_best_practices'
71  gem 'reek'
72  gem 'rubocop'
73  gem 'scss_lint', require: false
74  gem 'spring'
75  gem 'spring-watcher-listen', '~> 2.0.0'
76  gem 'web-console', '>= 3.3.0'
77end
78
79group :test do
80  # Adds support for Capybara system testing and selenium driver
81  gem 'capybara', '>= 2.15'
82  gem 'rspec_junit_formatter'
83  gem 'selenium-webdriver'
84  # Easy installation and use of web drivers to run system tests with browsers
85  gem 'webdrivers'
86  gem 'webmock'
87end
88
89# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
90gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
91
92gem 'administrate', '0.12.0'
93gem 'bootstrap', '~> 4.3', '>= 4.3.1'
94gem 'devise', '~> 4.6', '>= 4.6.1'
95gem 'devise-bootstrapped',  github: 'excid3/devise-bootstrapped',
96                            branch: 'bootstrap4'
97gem 'devise_masquerade', '~> 0.6.2'
98gem 'font-awesome-sass', '~> 5.6', '>= 5.6.1'
99gem 'friendly_id', '~> 5.2', '>= 5.2.5'
100gem 'gibbon'
101gem 'gmaps4rails'
102gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag'
103gem 'httparty'
104gem 'mini_magick', '~> 4.9', '>= 4.9.2'
105gem 'name_of_person', '~> 1.1'
106gem 'omniauth-facebook', '~> 5.0'
107gem 'omniauth-github', '~> 1.3'
108gem 'omniauth-twitter', '~> 1.4'
109gem 'pundit', '~> 1.1.0'
110gem 'sidekiq', '~> 5.2', '>= 5.2.5'
111gem 'sitemap_generator', '~> 6.0', '>= 6.0.1'
112gem 'underscore-rails'
113gem 'whenever', require: false
114
115docker-compose build
116docker-compose up
117

Along with every combination of the following:-

  • Using bundle update mimemagic in my dockerfile
  • Adding the gem specifically to my Gemfile with gem 'mimemagic', '~> 0.3.7'
  • Manually changing my Gemfile.lock mimemagic version from 0.3.5 to 0.3.7
  • Adding RUN apt-get install shared-mime-info to my Dockefile

and I simply get one of the below:-

1FROM ruby:2.7
2RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
3WORKDIR /radius
4COPY Gemfile /myapp/Gemfile
5COPY Gemfile.lock /myapp/Gemfile.lock
6RUN bundle update mimemagic
7RUN bundle install
8COPY . /myapp
9
10
11COPY entrypoint.sh /usr/bin/
12RUN chmod +x /usr/bin/entrypoint.sh
13ENTRYPOINT ["entrypoint.sh"]
14EXPOSE 3000
15
16
17CMD ["rails", "server", "-b", "0.0.0.0"]
18# frozen_string_literal: true
19
20source 'https://rubygems.org'
21git_source(:github) { |repo| "https://github.com/#{repo}.git" }
22
23ruby '2.7.2'
24gem 'airbrake'
25
26# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
27gem 'dotenv-rails'
28gem 'rails', '~> 6.0.3.6'
29# Use postgresql as the database for Active Record
30gem 'pg', '>= 0.18', '< 2.0'
31# Use Puma as the app server
32gem 'puma', '~> 3.11'
33# Use SCSS for stylesheets
34gem 'sass-rails', '~> 5'
35gem 'shortener'
36
37# Use Honeybadger for error reporting/monitoring
38gem 'honeybadger', '~> 4.0'
39# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
40gem 'webpacker', '~> 4.0'
41# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
42gem 'turbolinks', '~> 5'
43# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
44gem 'jbuilder', '~> 2.5'
45# Use Redis adapter to run Action Cable in production
46# gem 'redis', '~> 4.0'
47# Use Active Model has_secure_password
48# gem 'bcrypt', '~> 3.1.7'
49gem 'newrelic_rpm'
50
51# Use Active Storage variant
52# gem 'image_processing', '~> 1.2'
53
54# Reduces boot times through caching; required in config/boot.rb
55gem 'bootsnap', '>= 1.4.2', require: false
56
57group :development, :test do
58  gem 'awesome_print'
59  gem 'byebug', platforms: %i[mri mingw x64_mingw]
60  gem 'pry-byebug'
61  # Version specified as workaround for this issue https://github.com/rails/rails/issues/35417
62  gem 'rspec-rails', '~> 4.0.0.beta2'
63end
64
65group :development do
66  gem 'factory_bot_rails', '~> 4.0'
67  gem 'fasterer'
68  gem 'haml_lint', require: false
69  gem 'listen', '>= 3.0.5', '< 3.2'
70  gem 'rails_best_practices'
71  gem 'reek'
72  gem 'rubocop'
73  gem 'scss_lint', require: false
74  gem 'spring'
75  gem 'spring-watcher-listen', '~> 2.0.0'
76  gem 'web-console', '>= 3.3.0'
77end
78
79group :test do
80  # Adds support for Capybara system testing and selenium driver
81  gem 'capybara', '>= 2.15'
82  gem 'rspec_junit_formatter'
83  gem 'selenium-webdriver'
84  # Easy installation and use of web drivers to run system tests with browsers
85  gem 'webdrivers'
86  gem 'webmock'
87end
88
89# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
90gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
91
92gem 'administrate', '0.12.0'
93gem 'bootstrap', '~> 4.3', '>= 4.3.1'
94gem 'devise', '~> 4.6', '>= 4.6.1'
95gem 'devise-bootstrapped',  github: 'excid3/devise-bootstrapped',
96                            branch: 'bootstrap4'
97gem 'devise_masquerade', '~> 0.6.2'
98gem 'font-awesome-sass', '~> 5.6', '>= 5.6.1'
99gem 'friendly_id', '~> 5.2', '>= 5.2.5'
100gem 'gibbon'
101gem 'gmaps4rails'
102gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag'
103gem 'httparty'
104gem 'mini_magick', '~> 4.9', '>= 4.9.2'
105gem 'name_of_person', '~> 1.1'
106gem 'omniauth-facebook', '~> 5.0'
107gem 'omniauth-github', '~> 1.3'
108gem 'omniauth-twitter', '~> 1.4'
109gem 'pundit', '~> 1.1.0'
110gem 'sidekiq', '~> 5.2', '>= 5.2.5'
111gem 'sitemap_generator', '~> 6.0', '>= 6.0.1'
112gem 'underscore-rails'
113gem 'whenever', require: false
114
115docker-compose build
116docker-compose up
117Could not find mimemagic-0.3.x in any of the sources
118
1FROM ruby:2.7
2RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
3WORKDIR /radius
4COPY Gemfile /myapp/Gemfile
5COPY Gemfile.lock /myapp/Gemfile.lock
6RUN bundle update mimemagic
7RUN bundle install
8COPY . /myapp
9
10
11COPY entrypoint.sh /usr/bin/
12RUN chmod +x /usr/bin/entrypoint.sh
13ENTRYPOINT ["entrypoint.sh"]
14EXPOSE 3000
15
16
17CMD ["rails", "server", "-b", "0.0.0.0"]
18# frozen_string_literal: true
19
20source 'https://rubygems.org'
21git_source(:github) { |repo| "https://github.com/#{repo}.git" }
22
23ruby '2.7.2'
24gem 'airbrake'
25
26# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
27gem 'dotenv-rails'
28gem 'rails', '~> 6.0.3.6'
29# Use postgresql as the database for Active Record
30gem 'pg', '>= 0.18', '< 2.0'
31# Use Puma as the app server
32gem 'puma', '~> 3.11'
33# Use SCSS for stylesheets
34gem 'sass-rails', '~> 5'
35gem 'shortener'
36
37# Use Honeybadger for error reporting/monitoring
38gem 'honeybadger', '~> 4.0'
39# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
40gem 'webpacker', '~> 4.0'
41# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
42gem 'turbolinks', '~> 5'
43# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
44gem 'jbuilder', '~> 2.5'
45# Use Redis adapter to run Action Cable in production
46# gem 'redis', '~> 4.0'
47# Use Active Model has_secure_password
48# gem 'bcrypt', '~> 3.1.7'
49gem 'newrelic_rpm'
50
51# Use Active Storage variant
52# gem 'image_processing', '~> 1.2'
53
54# Reduces boot times through caching; required in config/boot.rb
55gem 'bootsnap', '>= 1.4.2', require: false
56
57group :development, :test do
58  gem 'awesome_print'
59  gem 'byebug', platforms: %i[mri mingw x64_mingw]
60  gem 'pry-byebug'
61  # Version specified as workaround for this issue https://github.com/rails/rails/issues/35417
62  gem 'rspec-rails', '~> 4.0.0.beta2'
63end
64
65group :development do
66  gem 'factory_bot_rails', '~> 4.0'
67  gem 'fasterer'
68  gem 'haml_lint', require: false
69  gem 'listen', '>= 3.0.5', '< 3.2'
70  gem 'rails_best_practices'
71  gem 'reek'
72  gem 'rubocop'
73  gem 'scss_lint', require: false
74  gem 'spring'
75  gem 'spring-watcher-listen', '~> 2.0.0'
76  gem 'web-console', '>= 3.3.0'
77end
78
79group :test do
80  # Adds support for Capybara system testing and selenium driver
81  gem 'capybara', '>= 2.15'
82  gem 'rspec_junit_formatter'
83  gem 'selenium-webdriver'
84  # Easy installation and use of web drivers to run system tests with browsers
85  gem 'webdrivers'
86  gem 'webmock'
87end
88
89# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
90gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
91
92gem 'administrate', '0.12.0'
93gem 'bootstrap', '~> 4.3', '>= 4.3.1'
94gem 'devise', '~> 4.6', '>= 4.6.1'
95gem 'devise-bootstrapped',  github: 'excid3/devise-bootstrapped',
96                            branch: 'bootstrap4'
97gem 'devise_masquerade', '~> 0.6.2'
98gem 'font-awesome-sass', '~> 5.6', '>= 5.6.1'
99gem 'friendly_id', '~> 5.2', '>= 5.2.5'
100gem 'gibbon'
101gem 'gmaps4rails'
102gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag'
103gem 'httparty'
104gem 'mini_magick', '~> 4.9', '>= 4.9.2'
105gem 'name_of_person', '~> 1.1'
106gem 'omniauth-facebook', '~> 5.0'
107gem 'omniauth-github', '~> 1.3'
108gem 'omniauth-twitter', '~> 1.4'
109gem 'pundit', '~> 1.1.0'
110gem 'sidekiq', '~> 5.2', '>= 5.2.5'
111gem 'sitemap_generator', '~> 6.0', '>= 6.0.1'
112gem 'underscore-rails'
113gem 'whenever', require: false
114
115docker-compose build
116docker-compose up
117Could not find mimemagic-0.3.x in any of the sources
118web_1  | Bundler::GemNotFound: You have requested:
119web_1  |   mimemagic ~> 0.3.7
120web_1  | 
121web_1  | The bundle currently has mimemagic locked at 0.3.5.
122web_1  | Try running `bundle update mimemagic`
123
124

I've also tried bumping rails to 6.0.3.6 and running the docker build again, which gives me activesupport issues:-

1FROM ruby:2.7
2RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
3WORKDIR /radius
4COPY Gemfile /myapp/Gemfile
5COPY Gemfile.lock /myapp/Gemfile.lock
6RUN bundle update mimemagic
7RUN bundle install
8COPY . /myapp
9
10
11COPY entrypoint.sh /usr/bin/
12RUN chmod +x /usr/bin/entrypoint.sh
13ENTRYPOINT ["entrypoint.sh"]
14EXPOSE 3000
15
16
17CMD ["rails", "server", "-b", "0.0.0.0"]
18# frozen_string_literal: true
19
20source 'https://rubygems.org'
21git_source(:github) { |repo| "https://github.com/#{repo}.git" }
22
23ruby '2.7.2'
24gem 'airbrake'
25
26# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
27gem 'dotenv-rails'
28gem 'rails', '~> 6.0.3.6'
29# Use postgresql as the database for Active Record
30gem 'pg', '>= 0.18', '< 2.0'
31# Use Puma as the app server
32gem 'puma', '~> 3.11'
33# Use SCSS for stylesheets
34gem 'sass-rails', '~> 5'
35gem 'shortener'
36
37# Use Honeybadger for error reporting/monitoring
38gem 'honeybadger', '~> 4.0'
39# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
40gem 'webpacker', '~> 4.0'
41# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
42gem 'turbolinks', '~> 5'
43# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
44gem 'jbuilder', '~> 2.5'
45# Use Redis adapter to run Action Cable in production
46# gem 'redis', '~> 4.0'
47# Use Active Model has_secure_password
48# gem 'bcrypt', '~> 3.1.7'
49gem 'newrelic_rpm'
50
51# Use Active Storage variant
52# gem 'image_processing', '~> 1.2'
53
54# Reduces boot times through caching; required in config/boot.rb
55gem 'bootsnap', '>= 1.4.2', require: false
56
57group :development, :test do
58  gem 'awesome_print'
59  gem 'byebug', platforms: %i[mri mingw x64_mingw]
60  gem 'pry-byebug'
61  # Version specified as workaround for this issue https://github.com/rails/rails/issues/35417
62  gem 'rspec-rails', '~> 4.0.0.beta2'
63end
64
65group :development do
66  gem 'factory_bot_rails', '~> 4.0'
67  gem 'fasterer'
68  gem 'haml_lint', require: false
69  gem 'listen', '>= 3.0.5', '< 3.2'
70  gem 'rails_best_practices'
71  gem 'reek'
72  gem 'rubocop'
73  gem 'scss_lint', require: false
74  gem 'spring'
75  gem 'spring-watcher-listen', '~> 2.0.0'
76  gem 'web-console', '>= 3.3.0'
77end
78
79group :test do
80  # Adds support for Capybara system testing and selenium driver
81  gem 'capybara', '>= 2.15'
82  gem 'rspec_junit_formatter'
83  gem 'selenium-webdriver'
84  # Easy installation and use of web drivers to run system tests with browsers
85  gem 'webdrivers'
86  gem 'webmock'
87end
88
89# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
90gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
91
92gem 'administrate', '0.12.0'
93gem 'bootstrap', '~> 4.3', '>= 4.3.1'
94gem 'devise', '~> 4.6', '>= 4.6.1'
95gem 'devise-bootstrapped',  github: 'excid3/devise-bootstrapped',
96                            branch: 'bootstrap4'
97gem 'devise_masquerade', '~> 0.6.2'
98gem 'font-awesome-sass', '~> 5.6', '>= 5.6.1'
99gem 'friendly_id', '~> 5.2', '>= 5.2.5'
100gem 'gibbon'
101gem 'gmaps4rails'
102gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag'
103gem 'httparty'
104gem 'mini_magick', '~> 4.9', '>= 4.9.2'
105gem 'name_of_person', '~> 1.1'
106gem 'omniauth-facebook', '~> 5.0'
107gem 'omniauth-github', '~> 1.3'
108gem 'omniauth-twitter', '~> 1.4'
109gem 'pundit', '~> 1.1.0'
110gem 'sidekiq', '~> 5.2', '>= 5.2.5'
111gem 'sitemap_generator', '~> 6.0', '>= 6.0.1'
112gem 'underscore-rails'
113gem 'whenever', require: false
114
115docker-compose build
116docker-compose up
117Could not find mimemagic-0.3.x in any of the sources
118web_1  | Bundler::GemNotFound: You have requested:
119web_1  |   mimemagic ~> 0.3.7
120web_1  | 
121web_1  | The bundle currently has mimemagic locked at 0.3.5.
122web_1  | Try running `bundle update mimemagic`
123
124web_1  | Bundler::VersionConflict: Bundler could not find compatible versions for gem "activesupport":
125web_1  |   In snapshot (Gemfile.lock):
126web_1  |     activesupport (= 6.0.3.5)
127web_1  | 
128web_1  |   In Gemfile:
129web_1  |     rails (~> 6.0.3.6) was resolved to 6.0.3.6, which depends on
130web_1  |       activesupport (= 6.0.3.6)
131web_1  | 
132web_1  |     dotenv-rails was resolved to 2.7.6, which depends on
133web_1  |       railties (>= 3.2) was resolved to 6.0.3.5, which depends on
134web_1  |         activesupport (= 6.0.3.5)
135web_1  | 
136web_1  | Running `bundle update` will rebuild your snapshot from scratch, using only
137web_1  | the gems in your Gemfile, which may resolve the conflict.
138
139

What exactly do I need to do to get this gem to install?

ANSWER

Answered 2021-Mar-28 at 23:41
1FROM ruby:2.7
2RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
3WORKDIR /radius
4COPY Gemfile /myapp/Gemfile
5COPY Gemfile.lock /myapp/Gemfile.lock
6RUN bundle update mimemagic
7RUN bundle install
8COPY . /myapp
9
10
11COPY entrypoint.sh /usr/bin/
12RUN chmod +x /usr/bin/entrypoint.sh
13ENTRYPOINT ["entrypoint.sh"]
14EXPOSE 3000
15
16
17CMD ["rails", "server", "-b", "0.0.0.0"]
18# frozen_string_literal: true
19
20source 'https://rubygems.org'
21git_source(:github) { |repo| "https://github.com/#{repo}.git" }
22
23ruby '2.7.2'
24gem 'airbrake'
25
26# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
27gem 'dotenv-rails'
28gem 'rails', '~> 6.0.3.6'
29# Use postgresql as the database for Active Record
30gem 'pg', '>= 0.18', '< 2.0'
31# Use Puma as the app server
32gem 'puma', '~> 3.11'
33# Use SCSS for stylesheets
34gem 'sass-rails', '~> 5'
35gem 'shortener'
36
37# Use Honeybadger for error reporting/monitoring
38gem 'honeybadger', '~> 4.0'
39# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
40gem 'webpacker', '~> 4.0'
41# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
42gem 'turbolinks', '~> 5'
43# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
44gem 'jbuilder', '~> 2.5'
45# Use Redis adapter to run Action Cable in production
46# gem 'redis', '~> 4.0'
47# Use Active Model has_secure_password
48# gem 'bcrypt', '~> 3.1.7'
49gem 'newrelic_rpm'
50
51# Use Active Storage variant
52# gem 'image_processing', '~> 1.2'
53
54# Reduces boot times through caching; required in config/boot.rb
55gem 'bootsnap', '>= 1.4.2', require: false
56
57group :development, :test do
58  gem 'awesome_print'
59  gem 'byebug', platforms: %i[mri mingw x64_mingw]
60  gem 'pry-byebug'
61  # Version specified as workaround for this issue https://github.com/rails/rails/issues/35417
62  gem 'rspec-rails', '~> 4.0.0.beta2'
63end
64
65group :development do
66  gem 'factory_bot_rails', '~> 4.0'
67  gem 'fasterer'
68  gem 'haml_lint', require: false
69  gem 'listen', '>= 3.0.5', '< 3.2'
70  gem 'rails_best_practices'
71  gem 'reek'
72  gem 'rubocop'
73  gem 'scss_lint', require: false
74  gem 'spring'
75  gem 'spring-watcher-listen', '~> 2.0.0'
76  gem 'web-console', '>= 3.3.0'
77end
78
79group :test do
80  # Adds support for Capybara system testing and selenium driver
81  gem 'capybara', '>= 2.15'
82  gem 'rspec_junit_formatter'
83  gem 'selenium-webdriver'
84  # Easy installation and use of web drivers to run system tests with browsers
85  gem 'webdrivers'
86  gem 'webmock'
87end
88
89# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
90gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
91
92gem 'administrate', '0.12.0'
93gem 'bootstrap', '~> 4.3', '>= 4.3.1'
94gem 'devise', '~> 4.6', '>= 4.6.1'
95gem 'devise-bootstrapped',  github: 'excid3/devise-bootstrapped',
96                            branch: 'bootstrap4'
97gem 'devise_masquerade', '~> 0.6.2'
98gem 'font-awesome-sass', '~> 5.6', '>= 5.6.1'
99gem 'friendly_id', '~> 5.2', '>= 5.2.5'
100gem 'gibbon'
101gem 'gmaps4rails'
102gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag'
103gem 'httparty'
104gem 'mini_magick', '~> 4.9', '>= 4.9.2'
105gem 'name_of_person', '~> 1.1'
106gem 'omniauth-facebook', '~> 5.0'
107gem 'omniauth-github', '~> 1.3'
108gem 'omniauth-twitter', '~> 1.4'
109gem 'pundit', '~> 1.1.0'
110gem 'sidekiq', '~> 5.2', '>= 5.2.5'
111gem 'sitemap_generator', '~> 6.0', '>= 6.0.1'
112gem 'underscore-rails'
113gem 'whenever', require: false
114
115docker-compose build
116docker-compose up
117Could not find mimemagic-0.3.x in any of the sources
118web_1  | Bundler::GemNotFound: You have requested:
119web_1  |   mimemagic ~> 0.3.7
120web_1  | 
121web_1  | The bundle currently has mimemagic locked at 0.3.5.
122web_1  | Try running `bundle update mimemagic`
123
124web_1  | Bundler::VersionConflict: Bundler could not find compatible versions for gem "activesupport":
125web_1  |   In snapshot (Gemfile.lock):
126web_1  |     activesupport (= 6.0.3.5)
127web_1  | 
128web_1  |   In Gemfile:
129web_1  |     rails (~> 6.0.3.6) was resolved to 6.0.3.6, which depends on
130web_1  |       activesupport (= 6.0.3.6)
131web_1  | 
132web_1  |     dotenv-rails was resolved to 2.7.6, which depends on
133web_1  |       railties (>= 3.2) was resolved to 6.0.3.5, which depends on
134web_1  |         activesupport (= 6.0.3.5)
135web_1  | 
136web_1  | Running `bundle update` will rebuild your snapshot from scratch, using only
137web_1  | the gems in your Gemfile, which may resolve the conflict.
138
139bundle update --conservative mimemagic 
140

also try with newer version rather than locking it. it worked for us with 0.3.9, but now there is 0.3.10(have not tried it),

Source https://stackoverflow.com/questions/66844316

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Nodejs

Tutorials and Learning Resources are not available at this moment for Nodejs

Share this Page

share link

Get latest updates on Nodejs