next-learn icon indicating copy to clipboard operation
next-learn copied to clipboard

Chapter 2 import style not working

Open amyming112 opened this issue 1 year ago • 5 comments

copying the code and importing global css does nothing to update the style.

Screenshot 2024-08-25 at 00 48 57 Screenshot 2024-08-25 at 00 48 43

amyming112 avatar Aug 24 '24 23:08 amyming112

instead of

import '@app/ui/global.css'

try

import '../app/ui/global.css'

eiffel205566 avatar Aug 25 '24 00:08 eiffel205566

Thanks. I tried a few different imports, including the import style from .. (from 2nd part of the tutorial), and I keep getting the below. same for chroms and safari.

I have imported the latest NextJS(as per the demo code) and npm i installed everything. also tried npm i canary, but got a loooooong error message about unable to resolve dependencies

Screenshot 2024-08-25 at 10 48 55

amyming112 avatar Aug 25 '24 09:08 amyming112

you shouldn't be running npm i

the doc is using "pnpm" (install thru npm) https://nextjs.org/learn/dashboard-app/getting-started#running-the-development-server

might wanna start from beginning or delete your node_modules and rerun pnpm i

eiffel205566 avatar Aug 25 '24 12:08 eiffel205566

I had the same issue, probably bc I ran npm i accidentally, but then I quit the process ctl c and ran pnpm i, so I thought it should be fine. Anyways, deleting node_modules and running pnpm i again solved the issue, but there's still a warning in the terminal:

(node:11645) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. (Use node --trace-warnings ... to show where the warning was created)

LuamB avatar Aug 27 '24 16:08 LuamB

I managed to get Chapter 2 working by changing: import styles from '@/app/ui/home.module.css'; to import styles from './ui/home.module.css'

GreytownSnowy avatar Oct 17 '24 09:10 GreytownSnowy

Looks like this was resolved

leerob avatar Dec 05 '24 21:12 leerob