如何修复生成 ENAMETOOLONG 错误 nrwl nx 工作区

nat*_*yus 18 javascript node.js npm typescript angular

一周前我用 nrwl/nx 生成了一个 Angular 项目,当时我可以生成库和组件并可以启动我的项目,但现在我收到以下错误:

spawn ENAMETOOLONG
Run Code Online (Sandbox Code Playgroud)

每当我尝试运行 npm run start 时就会出现此错误,该命令现在运行 nxserve。ng 服务也不起作用。我可以运行 npm install 但无法启动我的应用程序。这是我的 package.json 如果您需要任何其他信息我可以提供:

{
  "name": "moniesta-admin",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main",
    "start": "nx serve",
    "build": "nx build",
    "test": "nx test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~13.2.0",
    "@angular/cdk": "^13.0.0",
    "@angular/common": "~13.2.0",
    "@angular/compiler": "~13.2.0",
    "@angular/core": "~13.2.0",
    "@angular/forms": "~13.2.0",
    "@angular/localize": "~13.2.0",
    "@angular/material": "^13.2.2",
    "@angular/platform-browser": "~13.2.0",
    "@angular/platform-browser-dynamic": "~13.2.0",
    "@angular/router": "~13.2.0",
    "@nebular/auth": "^9.0.1",
    "@nebular/eva-icons": "^9.0.1",
    "@nebular/theme": "^9.0.1",
    "@ng-bootstrap/ng-bootstrap": "^11.0.0",
    "@nrwl/angular": "13.8.1",
    "bootstrap": "^5.1.3",
    "eva-icons": "^1.1.3",
    "rxjs": "~7.4.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~13.2.0",
    "@angular-eslint/eslint-plugin": "~13.0.1",
    "@angular-eslint/eslint-plugin-template": "~13.0.1",
    "@angular-eslint/template-parser": "~13.0.1",
    "@angular/cli": "~13.2.0",
    "@angular/compiler-cli": "~13.2.0",
    "@angular/language-service": "~13.2.0",
    "@nrwl/cli": "13.8.1",
    "@nrwl/cypress": "13.8.1",
    "@nrwl/eslint-plugin-nx": "13.8.1",
    "@nrwl/jest": "13.8.1",
    "@nrwl/linter": "13.8.1",
    "@nrwl/tao": "13.8.1",
    "@nrwl/workspace": "13.8.1",
    "@schematics/angular": "~13.2.0",
    "@types/jest": "27.0.2",
    "@types/node": "16.11.7",
    "@typescript-eslint/eslint-plugin": "~5.10.0",
    "@typescript-eslint/parser": "~5.10.0",
    "cypress": "^9.1.0",
    "eslint": "~8.7.0",
    "eslint-config-prettier": "8.1.0",
    "eslint-plugin-cypress": "^2.10.3",
    "jest": "27.2.3",
    "jest-preset-angular": "11.0.0",
    "prettier": "^2.5.1",
    "ts-jest": "27.0.5",
    "typescript": "~4.5.2"
  }
}
Run Code Online (Sandbox Code Playgroud)

编辑:

当我使用 nx 重置并再次使用 nx 服务时,会发生这种情况:

   Log file with the error: C:\Users\Hasan\OneDrive\Desktop\Moniesta-Projects\Moniesta-Combinatioon\moniesta-management\moniesta-admin\node_modules\.cache\nx\d\daemon-error.log
   Please file an issue at https://github.com/nrwl/nx
   Nx Daemon is going to be disabled until you run "nx reset".
Run Code Online (Sandbox Code Playgroud)

在守护程序日志中,它只显示相同的错误:

 NX   spawn ENAMETOOLONG
Run Code Online (Sandbox Code Playgroud)

jur*_*rev 44

当您有太多未提交的文件时(根据我的经验,范围超过 700 个左右),通常会出现此错误。提交文件通常可以解决问题。


小智 6

我刚刚遇到了同样的问题。我确实手动删除了node_modules文件夹,然后使用 npm install 重新安装了所有内容。还发现根文件夹中有一个新的.angular文件夹,该文件夹之前不存在。完全删除该文件夹后,我可以再次运行构建。不太确定是否运行nx build一次(再次填充此文件夹),您不应该再次将其删除。