错误:EISDIR:对目录进行非法操作,readlink 'D:\study\noobinjs\pages\_app.tsx'当尝试运行“npm run build”时对于下一个js应用程序

发布于 2025-01-14 12:34:12 字数 1547 浏览 4 评论 0原文

当尝试为下一个 js 应用程序运行 npm run build 时,我收到上述错误。 next.js 应用程序采用打字稿形式。 这是带有文件夹结构的错误屏幕截图 错误。无法理解为什么 _app.tsx 在这里被视为目录而不是文件。非常感谢任何帮助。提前致谢!

编辑:这只是一个默认使用 typescript 创建的基本 next.js 应用程序,其中包含上面错误屏幕截图左侧所示的文件夹结构。

下面是 _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

下面是我的 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"
  }
}

当我运行 npm run build 时收到错误错误:EISDIR: 对目录进行非法操作,readlink 'D:\study\noobinjs \pages_app.tsx'。

刚开始学习next.js,初次遇到这种情况。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

望她远 2025-01-21 12:34:12

尽量把项目文件放在C盘而不是D盘。
示例=> C:\Users\Mahmoud\Desktop\next-damo

然后尝试运行 npm run build

Try to put the file of project in C drive not in the D.
Example => C:\Users\Mahmoud\Desktop\next-damo

Then try to run npm run build.

对不⑦ 2025-01-21 12:34:12

这个问题可能与能否创建符号链接有关。
我也遇到了同样的问题,但通过将文件系统从 exFAT 更改为 NTFS 解决了它。
如您所知,exFAT 无法创建符号链接。

This problem may be related to whether the symbolic link can be created or not.
I also encountered the same problem, but solved it by changing the filesystem from exFAT to NTFS.
As you know exFAT can't create symlink.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文