Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 02 2020 06:16
    @ljharb banned @frank-dspeed
  • Apr 27 2018 01:23
    @MylesBorins banned @fjeddy
  • Feb 24 2016 08:26
    @rvagg banned @jonathanenbe
Suchitra Giri
@SUCHITRAGIRI
@snxraven:matrix-linux.cloud see!
Everything seems to be fine but still showing error:(
C:\Users\HP\Desktop\nodeDocker>docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
Creating network "nodedocker_default" with the default driver
Creating nodedocker_mongo_1    ... done
Creating nodedocker_node-app_1 ... done

C:\Users\HP\Desktop\nodeDocker>docker ps
CONTAINER ID   IMAGE                 COMMAND                  CREATED          STATUS          PORTS
       NAMES
d418e635530a   nodedocker_node-app   "docker-entrypoint.s…"   13 seconds ago   Up 5 seconds    0.0.0.0:3000->3000/tcp, :::3000->3000/tcp   nodedocker_node-app_1
c8ca51a81d22   mongo                 "docker-entrypoint.s…"   14 seconds ago   Up 12 seconds   27017/tcp
       nodedocker_mongo_1

C:\Users\HP\Desktop\nodeDocker>docker logs    

C:\Users\HP\Desktop\nodeDocker>docker logs nodedocker_node-app_1

> nodeDocker@1.0.0 dev
> nodemon -L index.js

[nodemon] 2.0.12
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json  
[nodemon] starting `node index.js`
node:internal/modules/cjs/loader:927
  throw err;
  ^

Error: Cannot find module 'mongoose'
Require stack:
- /app/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/app/index.js:2:18)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/app/index.js' ]
}
[nodemon] app crashed - waiting for file changes before starting...
snxraven
@snxraven:matrix-linux.cloud
[m]
The container itself is whats missing mongoose. How are you installing the module within your compose?
2 replies
Suchitra Giri
@SUCHITRAGIRI
And also localhost:3000 is not working now.
For solving the issue, I removed the node_modules and package-lock.json and reinstalled again. But still getting same error:(
What should I do now??
Please suggest it would to very appreciated.
snxraven
@snxraven:matrix-linux.cloud
[m]

In your compose you need

RUN npm install mongoose

That will install mongoose within the container
Its running node in the container not the host OS so you are required to install mongoose using compose as instructed above
That will be added to the compose yml you are using
Suchitra Giri
@SUCHITRAGIRI

See..
this is my docker-compose.yml file

version: "3"
services:
  node-app:
    build: .
    ports:
      - "3000:3000"
    environment:
      - PORT=3000

  mongo:
    image: mongo
    environment:
      MONGO_INITDB_ROOT_USERNAME: <>
      MONGO_INITDB_ROOT_PASSWORD: <>
    volumes:
      - mongo-db:/data/db

volumes:
  mongo-db:

and this is docker-compose.dev.yml

version: "3"
services:
  node-app:
    build:
      context: .
      args:
        NODE_ENV: development
    volumes:
      - ./:/app
      - /app/node_modules
    environment:
      - NODE_ENV=development
    command: npm run dev

this is docker-compose.prod.yml

version: "3"
services:
  node-app:
    build:
      context: .
      args:
        NODE_ENV: production
    environment:
      - NODE_ENV=production
    command: node index.js
@snxraven:matrix-linux.cloud where should I write
RUN npm install mongoose
snxraven
@snxraven:matrix-linux.cloud
[m]
npm install mongoose
Oops lol
That might help some. On my way to lunch break. Bbl
snxraven
@snxraven:matrix-linux.cloud
[m]
You are welcome, I am glad you got the package installed. You will want to do some reading on Dockerfiles vs Docker Compose and how to use them, the link I provided above gives a bit of a run down for that process. I wish you luck with your development :)
jsoneaday
@jsoneaday
Does anyone know if node team will eventually move to using Rust language?
snxraven
@snxraven:matrix-linux.cloud
[m]
They are completely different langs, that would not make any sense
mr.james
@st-fresh
anyone using the mysql package="@mysql/xdevapi": "^8.0.26" ?
trying to use the .getSession method to establish connection to locally running mysql db.. https://dev.mysql.com/doc/dev/connector-nodejs/8.0/tutorial-Connecting_to_a_Server.html
shell returns connect ECONNREFUSED 127.0.0.1:33060
mr.james
@st-fresh
my module..
const MySql = require("@mysql/xdevapi"); 

const config = {
    password: '...',
    user: 'root',
    host: 'localhost',
    port: 33060
};

MySql.getSession(config)
    .then(session => {
        console.log(session.inspect());
    })
    .catch(err => {
        console.log(err.message); 
    });
locally running MySQL Community Server 8.0.26 on macOS
mr.james
@st-fresh
Firewall is off
just tried.. MySql.getSession('http://localhost:33060?ssl-mode=DISABLED') because didn't configure local mysql to use ssl/tls but same ECONNREFUSED
Htc Saj
@htcsaj123_gitlab
How to get notifications when someone post something new on Reddit, and how to scrape that new posts. I scrappe data and I can scrape data from current posts on pages like Reddit
John Melody Me
@johnmelodyme

Hey guys I use cheerio to scrape this table but it return nothing. Did I somehow did wrong ?

<table class="table trackTable">
                    <thead>
                            <tr>
                                <th colspan="4">Consignment No: MY37011088606</th>
                            </tr>
                        <tr>
                            <th>Consignment No</th>
                            <th>Date &amp; Time</th>
                            <th>Status</th>
                            <th>Location</th>
                        </tr>
                    </thead>
                    <tbody>
                                <tr>
                                    <td>MY37011088606</td>
                                    <td>03/07/2020 14:58:43</td>

                                        <td><b>Delivered</b></td>

                                    <td>Butterworth</td>
                                </tr>
                          .....
                </table>

and my code was

$ = cheerio.load(response['data']);

            $.html();

            $('.table#trackTable').each((index, element) => {
                if (index === 0) return (true);

                console.log(element)
            });

Any idea ? is the naming of the selctor wrong?

in the browser i did

$(".table > tbody:nth-child(2)").each(function(i,item) { console.log(item.innerText) });

and it return something , but cheerio doesn't

Jordan Harband
@ljharb
table is a tag, not a class, i assue
you want table not .table
altho i see your table has a table class (which is bizarre) so maybe that should work
oh
trackTable is also a class, not an ID.
so .table.trackTable not .table#trackTable
John Melody Me
@johnmelodymel:matrix.org
[m]
I see
Actually I solved it already
Thanks tho
MERN Micro Framework
@mernjs

Hello Everyone, MERN Stack Boilerplate provides starter kits for building web, desktop and mobile apps in pure JavaScript.

https://www.npmjs.com/package/create-mernjs-app

If you have any query or suggestions. Please let me know.

Money_isss
@Money_isss_twitter
How to develope a site with backend within 1 hour ???
3 replies
Jordan Harband
@ljharb
you can't
Haris
@Wulf
lol
Schulzkafer
@Schulzkafer
there is a lot of videos in Youtube about how to create MERN within 1h :)
Salathiel Genèse
@SalathielGenese
Which is part of the problem in the industry
*s
Jordan Harband
@ljharb
especially since the M in there is a terrible choice
Salathiel Genèse
@SalathielGenese
!
Jordan Harband
@ljharb
postgres is a better json document store than mongo, even. mongo's garbage.
Schulzkafer
@Schulzkafer
It's not so difficult to create a (bad) site, but I think if once I'll create a useful website that people would like :)
bad/useless
Ali Bulut
@ali27001
I made a mern project. I deployed backend heroku. I am logging in with passport js. It works locally but not live. It looks like it cannot find cookies for api queries after login. what could be the problem
Vineet Srivastav
@vineetvk01
Cors issue because of domains ^
Maybe Try changing secure cookie settings