maxwfreu / next-video-chat Goto Github PK
View Code? Open in Web Editor NEWA video chat app made with Next.js and Socket.io
A video chat app made with Next.js and Socket.io
I created next app using npx create-next-app
All files given in here were copied and created in the project.
deleted package.json
npm init
copied dependencies and scripts from this repo into package.json
deleted folder node_modules
npm i
modified script: "dev": nodemon serve.js
Installed missing packages like isomorphic-unfetch and glob
npm run dev
Following output on cli
bipin289@Bipins-MBP next-video-chat % npm run dev
[email protected] dev /Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat
nodemon server.js
[nodemon] 2.0.2
[nodemon] to restart at any time, enter rs
[nodemon] watching dir(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting node server.js
/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/next-server/server/config.js:8
if(path!=null&&path.length){var _userConfig$amp,_userConfig$experimen;const userConfigModule=require(path);const userConfig=normalizeConfig(phase,userConfigModule.default||userConfigModule);if(Object.keys(userConfig).length===0){Log.warn('Detected next.config.js, no exported configuration found. https://err.sh/vercel/next.js/empty-configuration');}if(userConfig.target&&!targets.includes(userConfig.target)){throw new Error(Specified target is invalid. Provided: "${userConfig.target}" should be one of ${targets.join(', ')}
);}if((_userConfig$amp=userConfig.amp)!=null&&_userConfig$amp.canonicalBase){const{canonicalBase}=userConfig.amp||{};userConfig.amp=userConfig.amp||{};userConfig.amp.canonicalBase=(canonicalBase.endsWith('/')?canonicalBase.slice(0,-1):canonicalBase)||'';}if((_userConfig$experimen=userConfig.experimental)!=null&&_userConfig$experimen.reactMode&&!reactMo
Error: Specified target is invalid. Provided: "node" should be one of server, serverless, experimental-serverless-trace
at loadConfig (/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/next-server/server/config.js:8:417)
at new Server (/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/next-server/server/next-server.js:1:4533)
at new DevServer (/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/server/next-dev-server.js:1:2964)
at createServer (/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/server/next.js:2:607)
at Object. (/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/server.js:8:17)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
at internal/main/run_main_module.js:17:11
[nodemon] app crashed - waiting for file changes before starting...
Please guide to resolve this issue.
next.config.js
const path = require("path");
const glob = require("glob");
module.exports = {
entry: ["server.js"],
output: {
filename: "bundle.js",
},
target: "node",
webpack: (config) => {
// Fixes npm packages that depend on `fs` module
config.node = {
fs: "empty",
};
config.module.rules.push(
{
test: /\.(css|scss)/,
loader: "emit-file-loader",
options: {
name: "dist/[path][name].[ext]",
},
},
{
test: /\.css$/,
use: ["babel-loader", "raw-loader", "postcss-loader"],
},
{
test: /\.s(a|c)ss$/,
use: [
"babel-loader",
"raw-loader",
"postcss-loader",
{
loader: "sass-loader",
options: {
includePaths: ["styles", "node_modules"]
.map((d) => path.join(__dirname, d))
.map((g) => glob.sync(g))
.reduce((a, c) => a.concat(c), []),
},
},
],
}
);
return config;
},
};
On getting this error, I tried ti build the proj by running: npm run build and got following error:
^C
bipin289@Bipins-MBP next-video-chat % npm run build
[email protected] build /Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat
next build
warn - React 17.0.1 or newer will be required to leverage all of the upcoming features in Next.js 11. Read more: https://err.sh/next.js/react-version
Build error occurred
Error: Specified target is invalid. Provided: "node" should be one of server, serverless, experimental-serverless-trace
at loadConfig (/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/next-server/server/config.js:8:417)
at /Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/build/index.js:2:227
at /Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/build/tracer.js:3:360
at NoopTracer.withSpan (/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js:47:16)
at ProxyTracer.withSpan (/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js:36:34)
at traceFn (/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/build/tracer.js:3:330)
at /Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/build/index.js:2:158
at /Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/build/tracer.js:3:476
at NoopTracer.withSpan (/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js:47:16)
at ProxyTracer.withSpan (/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js:36:34)
at traceAsyncFn (/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/build/tracer.js:3:435)
at build (/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/build/index.js:1:7253)
at /Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/next/dist/cli/next-build.js:17:1246
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:next build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/bipin289/.npm/_logs/2021-02-19T06_43_56_482Z-debug.log
bipin289@Bipins-MBP next-video-chat %
log is reproduced below:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]prebuild: [email protected]build: [email protected]
6 info lifecycle [email protected]
7 verbose lifecycle [email protected]build: unsafe-perm in lifecycle truebuild: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
8 verbose lifecycle [email protected]
9 verbose lifecycle [email protected]build: CWD: /Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chatbuild: Args: [ '-c', 'next build' ]
10 silly lifecycle [email protected]
11 silly lifecycle [email protected]build: Returned: code: 1 signal: nullbuild: Failed to exec build script
12 info lifecycle [email protected]
13 verbose stack Error: [email protected] build: next build
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:210:5)
13 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:210:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/bipin289/Desktop/Working-Dir/articles-examples-nextjs-snippets/next-video-chat
16 verbose Darwin 20.3.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v12.14.0
19 verbose npm v6.14.11
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: next build
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.