how to create a nextjs project with older version? - next.js

nextjs 13 has been released but when I create a new project I only want to use nextjs version 12, how can I do that?
All the install commands on the nextjs doc are creating a project folder with nextjs 13.
https://nextjs.org/docs

you can run this
npx create-next-app && cd myApp && npm i -S next#12
or this
npx create-next-app and then change next version to 12 from package.json manually

Related

What is CLI equivalent for "Would you like to use `src/` directory with this project" in Next.js 13.1.2

We have an automated image creation pipeline that uses CLI to create a default Next.js app and install dependencies, etc.
This is our code:
WORKDIR /
RUN npx --yes create-next-app next --use-npm --js --eslint
WORKDIR /next
Yesterday Next.js team released their 13.1.2 version, which broke this line.
They have added a new CLI option that asks:
? Would you like to use src/ directory with this project? › No / Yes
What is the option to automate the answer for this option?
The option you are looking for is --src-dir. So to automate the initialization using src directory you should run:
npx create-next-app --src-dir
Check documentation here

Dependencies with tailwind that are installed in Create react app

why dont we now install lib such as postcss and autoprfixers with tailwind css on CRA
Now If I go to Tailwind docs for installtion of tailwind into my react app which has been
created with CRA
https://tailwindcss.com/docs/guides/create-react-app
npm install -D tailwindcss
npx tailwindcss init
but if my memory serves right it used to be
npm install -D tailwindcss autoprefixer postcss
npx tailwindcss init
You are correct. According to this commit Tailwind has changed the installation guide.
They did this to discourage using CRA more since there are better tools out there to create a React app. For example Vite
From the Install Tailwind CSS with Create React App
Create React App does not support custom PostCSS configurations
When using Vite the Tailwind docs do say to install postcss and autoprefixer
npm create vite#latest my-project -- --template react
cd my-project
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p

Issues installing Tailwindcss, specifically with "npx tailwindcss init"

Im following the documentation but im stuck right at the npx tailwindcss init
https://tailwindcss.com/docs/installation
Check if your directory is initialized as a node project, i.e. it contains package.json file. If not then do this:
$/> npm init -y
Install tailwindcss as a dev dependency (optional as a dev dependency)
$/> npm i -D tailwindcss
Step : 1
Correct you directory path like this C:\Users\user\Documents\Web Dev\Tailwindcss_AlpineJs\pratice tailwind then try this command npx tailwindcss init
Step : 2
Not working above step : 1 then try this command : npx tailwindcss-cli#latest init -p.

How to use react-native-firebase

I'm using the react native firebase guide to install firebase in my react native app: https://rnfirebase.io/#2-android-setup
The installation has been successful and firebase is connected to my app.
However when I try to import from the SDK, I'm getting an error that it's not found:
import firebase from 'react-native-firebase'
The error reads:
Undefined Unable to resolve module 'react-native-firebase' from 'App.js'...
As the docs instruct I just used npm install like so:
npm install --save #react-native-firebase/app
And the package is indeed installed. So what could be the reason? Is it not an SDK anymore?
Step 1. Clear watchman watches: watchman watch-del-all
Step 2. Delete the node_modules folder: rm -rf node_modules && npm install
Step 3. Reset packager cache: npm start -- --reset-cache

Dotnet new - webpack.js missing

I downloaded .NET Core SDK version 2.1 and I ran :
dotnet new angular -n testAngular
... and the project was created successfully.
Then I ran:
cd testAngular
dotnet run
Which resulted in the following error :
EXEC : error : Cannot find module
C:\Users\OLE\source\repos\testAngular\node_modules\webpack\bin\webpack.js
How can I avoid this error? Adding an empty webpack.js didn't work. Why was webpack.js not added, when running dotnet new ? What should I put in it?
Thanks.
Your node_modules library doesn't have webpack installed.
Could be two reasons
Your package.json includes webpack, and you never installed it.
Inside testAngular run
npm install
Your project doesn't include webpack.
Inside testAngular run
npm install webpack -D
If you can't run npm, then install it from nodejs

Resources