CleverProgrammers / nodejs-zoom-clone

847 stars 484 forks source link

Comands to run #4

Open idsus opened 4 years ago

idsus commented 4 years ago

What are the commands to run for it to work/ run.

AmeerHamoodi commented 4 years ago

First install all the dependencies then run npm start and open localhost on port 3030

idsus commented 4 years ago

So what is the command to install the dependencies? @AmeerHamoodi

AmeerHamoodi commented 4 years ago

npm i or npm install just run that and it will auto install all dependencies

starc007 commented 4 years ago

After installing dependencies...type nodemon server.js

idsus commented 4 years ago

let me see

idsus commented 4 years ago

@starc007

idsus commented 4 years ago

@starc007 @AmeerHamoodi I got this error

C:\Users\susmitdas\Downloads\nodejs-zoom-clone-master\node_modules\uuid\dist\esm-browser\index.js:1 export { default as v1 } from './v1.js'; ^^^^^^

SyntaxError: Unexpected token 'export' at wrapSafe (internal/modules/cjs/loader.js:1060:16) at Module._compile (internal/modules/cjs/loader.js:1108:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10) at Module.load (internal/modules/cjs/loader.js:993:32) at Function.Module._load (internal/modules/cjs/loader.js:892:14) at Module.require (internal/modules/cjs/loader.js:1033:19) at require (internal/modules/cjs/helpers.js:72:18) at Object. (C:\Users\susmitdas\Downloads\nodejs-zoom-clone-master\server.js:11:24) at Module._compile (internal/modules/cjs/loader.js:1144:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)

starc007 commented 4 years ago

In place of export there will be 'import'

idsus commented 4 years ago

On all the export statements? export { default as v1 } from './v1.js'; export { default as v3 } from './v3.js'; export { default as v4 } from './v4.js'; export { default as v5 } from './v5.js'; export { default as NIL } from './nil.js'; export { default as version } from './version.js'; export { default as validate } from './validate.js'; export { default as stringify } from './stringify.js'; export { default as parse } from './parse.js';

idsus commented 4 years ago

C:\Users\susmitdas\Downloads\nodejs-zoom-clone-master\node_modules\uuid\dist\esm-browser\index.js:1 import { default as v1 } from './v1.js'; ^^^^^^

SyntaxError: Cannot use import statement outside a module at wrapSafe (internal/modules/cjs/loader.js:1060:16) at Module._compile (internal/modules/cjs/loader.js:1108:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10) at Module.load (internal/modules/cjs/loader.js:993:32) at Function.Module._load (internal/modules/cjs/loader.js:892:14) at Module.require (internal/modules/cjs/loader.js:1033:19) at require (internal/modules/cjs/helpers.js:72:18) at Object. (C:\Users\susmitdas\Downloads\nodejs-zoom-clone-master\server.js:11:24) at Module._compile (internal/modules/cjs/loader.js:1144:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)

@starc007

starc007 commented 4 years ago

Did you installed the dependencies by running npm install ?

AmeerHamoodi commented 4 years ago

If the method of running via nodemon is not working do npm start it worked for me when I was working on it locally @idontcareofusername

rrafay commented 4 years ago

npm install didn't work for me so I had to npm update

SyntaxError: Cannot use import statement outside a module

This error is probably because Node doesn't support import/export. You're going to need Babel to transcribe your ES6 to ES5 so node can run it. More information is found here: https://stackoverflow.com/questions/39005332/include-es6-class-from-external-file-in-node-js

The explanation & link above is for reference purposes -- don't worry about the error you're getting. You shouldn't have to change anything if you install the dependencies properly. Just npm update and the app should work.

Don't change the export/import statements as mentioned in the comments above(unless they're the one who contributed to this app, in that case I could be wrong.) The app runs for me without any modification besides installing the dependencies.

idsus commented 4 years ago
  1. Did npm update then npm start shows error 2 Did npm install and still shows same error 3 tried nodemon server and same error pops up

error:

`C:\Users\susmitdas\Downloads\nodejs-zoom-clone-master\node_modules\uuid\dist\esm-browser\index.js:1 export { default as v1 } from './v1.js'; ^^^^^^

SyntaxError: Unexpected token 'export'`

idsus commented 4 years ago

Code Server.js

const express = require('express') const app = express() // const cors = require('cors') // app.use(cors()) const server = require('http').Server(app) const io = require('socket.io')(server) const { ExpressPeerServer } = require('peer'); const peerServer = ExpressPeerServer(server, { debug: true }); const { v4: uuidV4 } = require('uuid') app.use('/peerjs', peerServer); app.set('view engine', 'ejs') app.use(express.static('public')) app.get('/', (req, res) => { res.redirect(/${uuidV4()}) }) app.get('/:room', (req, res) => { res.render('room', { roomId: req.params.room }) }) io.on('connection', socket => { socket.on('join-room', (roomId, userId) => { socket.join(roomId) socket.to(roomId).broadcast.emit('user-connected', userId); // messages socket.on('message', (message) => { //send message to the same room io.to(roomId).emit('createMessage', message) }); socket.on('disconnect', () => { socket.to(roomId).broadcast.emit('user-disconnected', userId) }) }) }) server.listen(process.env.PORT||3030)

Code Index.js export { default as v1 } from './v1.js'; export { default as v3 } from './v3.js'; export { default as v4 } from './v4.js'; export { default as v5 } from './v5.js'; export { default as NIL } from './nil.js'; export { default as version } from './version.js'; export { default as validate } from './validate.js'; export { default as stringify } from './stringify.js'; export { default as parse } from './parse.js';

idsus commented 4 years ago

@rrafay @starc007 @AmeerHamoodi

rrafay commented 4 years ago

What version of Node are you using @idontcareofusername ? Try updating node.

idsus commented 4 years ago

I updated but still error popped

starc007 commented 4 years ago

https://github.com/starc007/Zoom-Clone Try this...Code

idsus commented 4 years ago

excatly same error popped up 😓

AmeerHamoodi commented 4 years ago

What version of node are you on, not sure it would have an effect on your current issue but it may. Also, try cloning the repository in a new folder then running npm i then just doing npm start and let us know what happens

idsus commented 4 years ago

not working

idsus commented 4 years ago

I'm starting from scratch now and same error pops up after downloading a package that handles uuidv4

Starbors commented 4 years ago

Yo l might know your problem! did you install react???(in the first place) if not tell me and l will give you the code to do it!

idsus commented 4 years ago

What do you mean by installing react?

Starbors commented 4 years ago

You need to install react on your pc for the whole thing to work silly.

Starbors commented 4 years ago

1.Download the file 2.use npm install -g create-react-app in visual studio code 3.use npm i 4.use nodemon server.js 5.open port 3030 or l think its 3000 at localhost

Starbors commented 4 years ago

npm i or npm install takes a long time to install just saying

Starbors commented 4 years ago

a reply plz?

idsus commented 4 years ago

Ok let me try that. I think it might work!

Starbors commented 4 years ago

Ayyy l hope it does!!

anujmittal2308 commented 2 years ago

https://stackoverflow.com/questions/72003682/cant-fix-expresspeerserver-is-not-a-function-in-server-js