Im getting the above mentioned error when trying to run the npm run build for next js app. The next.js app is in typescript.
Here is the error screenshot with the folder structure
Error. Unable to understand why _app.tsx
is being considered as directory here instead of a file. Any help is much appreciated. Thanks in advance!
Edit: It's just a basic next.js app created with typescript by default containing the folder structure shown in the left side in the Error screenshot above.
Below is the code inside _app.tsx:
import 'tailwindcss/tailwind.css'
import React from 'react'
import { Layout } from '../components'
import '../styles/globals.scss'
import type { AppProps } from 'next/app'
function MyApp({ Component, pageProps }: AppProps) {
return (
<Layout>
<Component {...pageProps} />
</Layout>
)
}
export default MyApp
Below is my package.json
{
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"graphql": "^16.3.0",
"graphql-request": "^4.1.0",
"html-react-parser": "^1.4.8",
"moment": "^2.29.1",
"next": "latest",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-multi-carousel": "^2.8.0",
"sass": "^1.49.9"
},
"devDependencies": {
"@types/node": "17.0.4",
"@types/react": "17.0.38",
"autoprefixer": "^10.4.0",
"postcss": "^8.4.5",
"prettier": "^2.5.1",
"prettier-plugin-tailwindcss": "^0.1.1",
"tailwindcss": "^3.0.7",
"typescript": "4.5.4"
}
}
I receive error when I ran npm run build
as Error: EISDIR: illegal operation on a directory, readlink 'D:\study\noobinjs\pages_app.tsx'.
Just started learning next.js and this happens in the initial encounter.