mschwarzmueller / nextjs-course-code Goto Github PK
View Code? Open in Web Editor NEWSource code for my NextJS course (https://acad.link/nextjs)
Source code for my NextJS course (https://acad.link/nextjs)
Can i contribute to improve the resources?
First things first, thanks for the tutorial!
Neither the main nor the starting-prj branch contain the matching starter code shown at the 52:00 mark in the video at https://www.youtube.com/watch?v=MFuwkrseXVE
I'm not sure where the extra code is coming from, but git clone doesn't work as intended. It seems to clone an entirely different project.
Please, put .vscode/settings.json to gitignore, or set "window.zoomLevel": 0, before push. Thanks!
I think this course repo needs to be updated in other to work smoothly with next13 and react18 because I have been running into constant try to get starter-code up and running
error - components\events\event-item.js (17:36) @ EventItem
TypeError: Cannot read properties of undefined (reading 'replace')
15 | year: 'numeric',
16 | });
17 | const formattedAddress = location.replace(', ', '\n');
| ^
18 | const exploreLink =/events/${id}
;
19 |
20 | return (
Getting lots of errors after cloning the starter project and running npm install
and then npm run dev
chinmaysarupria@Chinmays-MacBook-Pro nextjs-course-code % npm install
added 342 packages, and audited 343 packages in 7s
52 packages are looking for funding
run `npm fund` for details
18 vulnerabilities (8 moderate, 9 high, 1 critical)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
chinmaysarupria@Chinmays-MacBook-Pro nextjs-course-code % npm run dev
> [email protected] dev
> next dev
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/parser' is not defined by "exports" in /Users/chinmaysarupria/nextapps/nextjs-course-code/node_modules/postcss/package.json
at new NodeError (node:internal/errors:371:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:429:9)
at packageExportsResolve (node:internal/modules/esm/resolve:683:3)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.552 (/Users/chinmaysarupria/nextapps/nextjs-course-code/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11590)
at __nccwpck_require__ (/Users/chinmaysarupria/nextapps/nextjs-course-code/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
at Object.270 (/Users/chinmaysarupria/nextapps/nextjs-course-code/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:400)
at __nccwpck_require__ (/Users/chinmaysarupria/nextapps/nextjs-course-code/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
at Object.327 (/Users/chinmaysarupria/nextapps/nextjs-course-code/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:260)
at __nccwpck_require__ (/Users/chinmaysarupria/nextapps/nextjs-course-code/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
at Object.845 (/Users/chinmaysarupria/nextapps/nextjs-course-code/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:3733) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Amazing course. Just curious why you always use regular functions instead of arrow functions? I know practically there isn't any difference, but just curious why you opt not to use arrow functions. Most of the code I see nowadays pretty much only uses arrow functions. Thanks.
At event-item component summary css is called but it doesn't exists and css module, it gives an eslint error.
I have a problem with fs. It is "module not found: Can't resolve "fs""
i think my app can't read fs. please if you have a time, send me an answer.
I cloned and wrote npm i. after that this problem appeared
Hi,
While I try to database MongoDB I got a lot of error
reason: TopologyDescription {
type: 'ReplicaSetNoPrimary',
servers: Map(1) { '127.0.0.1:27017' => [ServerDescription] },
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: 'rs0',
maxElectionId: null,
maxSetVersion: null,
commonWireVersion: 0,
logicalSessionTimeoutMinutes: null
},
code: undefined,
page: '/api/comments/[eventId]',
[Symbol(errorLabels)]: Set(0) {}
How can I fix this?
Instead of '' it is easier to use '' tag with 'element' prop within the tag. It makes it clear and easy to understand.
Thanks for the Next.js course, it helped a lot.
Hello:
In Lesson 190, once I add the line of code:
const postData = getPostData(slug);
Immediately I'm getting an 'ERR_REQUIRE_ESM' that keeps looping in the terminal. I have copied the code from [slug].js and posts-util.js from your nextjs-course-code on github into my project to make sure I didn't code something wrong and I'm still getting this looping error in the terminal. This is what the error looks like:
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\NextJS_Work\nextjs-course-code-full-blog\node_modules\react-markdown\index.js
require() of ES modules is not supported.
require() of C:\NextJS_Work\nextjs-course-code-full-blog\node_modules\react-markdown\index.js from C:\NextJS_Work\nextjs-course-code-full-blog.next\server\pages\posts[slug].js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\NextJS_Work\nextjs-course-code-full-blog\node_modules\react-markdown\package.json.
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1080:13)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.react-markdown (C:\NextJS_Work\nextjs-course-code-full-blog.next\server\pages\posts[slug].js:1157:18)
at webpack_require (C:\NextJS_Work\nextjs-course-code-full-blog.next\server\pages\posts[slug].js:23:31)
at Module../component/posts/post-detail/post-content.js (C:\NextJS_Work\nextjs-course-code-full-blog.next\server\pages\posts[slug].js:140:72)
at webpack_require (C:\NextJS_Work\nextjs-course-code-full-blog.next\server\pages\posts[slug].js:23:31)
at Module../pages/posts/[slug].js (C:\NextJS_Work\nextjs-course-code-full-blog.next\server\pages\posts[slug].js:1020:99)
at webpack_require (C:\NextJS_Work\nextjs-course-code-full-blog.next\server\pages\posts[slug].js:23:31)
at C:\NextJS_Work\nextjs-course-code-full-blog.next\server\pages\posts[slug].js:91:18
at Object. (C:\NextJS_Work\nextjs-course-code-full-blog.next\server\pages\posts[slug].js:94:10)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32) {
code: 'ERR_REQUIRE_ESM'
When I comment out that line of code that calls getPostData(slug) - which I know we do not want to do - the ERR_REQUIRE_ESM looping error stops but then I see this error in the terminal:
error - ./lib/posts-util.js:1:0
Module not found: Can't resolve 'fs'
1 | import fs from "fs";
I am using VS Code version 1.63.2.
I tried and I do not know how to get around this. Can you or somebody please help me with this error? I can no longer continue with this course until I can get around this issue, and I would really like to complete this course.
Thank you
I converted the final code to starting project code and updated the dependencies. One thing to care of is next-auth change some of the import like useSession is now in 'next-auth/react' (before 'next-auth/client')
Here is the link to starting project
When you use useSWR hook loading takes forever.
I m wondering why is that,but thats the fact,inside [feedbackId].js api route js array methods simply doesnt work
facing below error while try to run this command npm run dev
node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:3733) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
Hello, nice course, but there seems to be an issue with useRouter on pages/events/[...slug].js
Sometimes router.query.slug is an empty object and not only in pre-rendering phase. Especially wenn hitting enter instead of reloading the page.
To make sure not having any errors in my code I copied source code from your repo and changed the firebase url to my project.
I still get this error
I already did some research on this topic and tried to avoid this error by using 'router' Object in a useEffect without success. Using
useRouter().isReady as dependency did not work also. All in all quite unpredictable behaviour.
Also changed from "swr": "^2.2.1" to "swr": "^2.0.0" without success.
And also installed prj-05-data-fetching from this repository. Hitting enter a few times also leads to the described error.
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.