Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comands to run #4

Open
idsus opened this issue Aug 8, 2020 · 32 comments
Open

Comands to run #4

idsus opened this issue Aug 8, 2020 · 32 comments

Comments

@idsus
Copy link

idsus commented Aug 8, 2020

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

@AmeerHamoodi
Copy link

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

@idsus idsus closed this as completed Aug 9, 2020
@idsus idsus reopened this Aug 9, 2020
@idsus
Copy link
Author

idsus commented Aug 9, 2020

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

@AmeerHamoodi
Copy link

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

@starc007
Copy link

After installing dependencies...type nodemon server.js

@idsus
Copy link
Author

idsus commented Aug 10, 2020

let me see

@idsus
Copy link
Author

idsus commented Aug 10, 2020

@starc007

@idsus
Copy link
Author

idsus commented Aug 10, 2020

@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
Copy link

In place of export there will be 'import'

@idsus
Copy link
Author

idsus commented Aug 10, 2020

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
Copy link
Author

idsus commented Aug 10, 2020

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
Copy link

Did you installed the dependencies by running npm install ?

@AmeerHamoodi
Copy link

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
Copy link

rrafay commented Aug 10, 2020

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 idsus closed this as completed Aug 10, 2020
@idsus idsus reopened this Aug 10, 2020
@idsus
Copy link
Author

idsus commented Aug 10, 2020

  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
Copy link
Author

idsus commented Aug 10, 2020

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
Copy link
Author

idsus commented Aug 10, 2020

@rrafay
Copy link

rrafay commented Aug 10, 2020

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

@idsus
Copy link
Author

idsus commented Aug 11, 2020

I updated but still error popped

@starc007
Copy link

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

@idsus
Copy link
Author

idsus commented Aug 11, 2020

excatly same error popped up 😓

@AmeerHamoodi
Copy link

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
Copy link
Author

idsus commented Aug 29, 2020

not working

@idsus
Copy link
Author

idsus commented Sep 2, 2020

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

@Starbors
Copy link

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
Copy link
Author

idsus commented Sep 25, 2020

What do you mean by installing react?

@Starbors
Copy link

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

@Starbors
Copy link

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
Copy link

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

@Starbors
Copy link

a reply plz?

@idsus
Copy link
Author

idsus commented Sep 28, 2020

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

@Starbors
Copy link

Ayyy l hope it does!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants