简体   繁体   English

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

[英]How to fix spawn ENAMETOOLONG error nrwl nx workspace

I generated a week ago an angular project with nrwl/nx at that time I could generate libs and components and could start my project but right now I am getting the following error:一周前我生成了一个带有 nrwl/nx 的 angular 项目,当时我可以生成库和组件并可以启动我的项目,但现在我收到以下错误:

spawn ENAMETOOLONG

This error occurs whenever I am trying to run npm run start which runs nx serve right now.每当我尝试运行 npm run start 时,就会出现此错误,它现在运行 nx serve。 ng serve is not working either. ng serve 也不起作用。 I can run npm install but nothing to start my application.我可以运行 npm 安装,但无法启动我的应用程序。 Here is my package.json if you need any other information I can provide it:这是我的 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"
  }
}

EDIT:编辑:

This happens when i am using nx reset and after that using nx serve again:当我使用 nx reset 并且之后再次使用 nx serve 时会发生这种情况:

   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".

In the Daemon log it just says the same error:在守护进程日志中它只是说同样的错误:

 NX   spawn ENAMETOOLONG

This error usually appears when you have too many uncommited files (in a range more than 700 or so in my experience).当您有太多未提交的文件(根据我的经验,范围超过 700 个左右)时,通常会出现此错误。 Commiting the files will usually solve the problem.提交文件通常会解决问题。

I just ran into the same issue.我刚刚遇到了同样的问题。 I did delete the node_modules folder manually, then re-installed everything with npm install.我确实手动删除了node_modules文件夹,然后使用 npm install 重新安装了所有内容。 Also found that there is a new .angular folder in root folder, which was not present earlier.还发现根文件夹中有一个新的.angular文件夹,该文件夹之前不存在。 After deleting this folder entirely, I was able to run build again.完全删除此文件夹后,我能够再次运行构建。 Not really sure if running nx build once (which populates this folder again) you should not wipe it out once more.不确定是否运行nx build一次(再次填充此文件夹)您不应该再次将其清除。

I just ran into this issue.我刚遇到这个问题。 The solution that worked for me, I found it here对我有用的解决方案,我在 这里找到了

In my case, I was getting this error when running npm start , nx serve .就我而言,我在运行npm startnx serve时遇到了这个错误。 After deleting the node_modules folder and running npm install , I found that running npm install was giving me this error too.删除node_modules文件夹并运行npm install后,我发现运行npm install也给了我这个错误。

I had uncommitted changes on the branch.我在分支上有未提交的更改。 The error disappeared after committing the work.提交工作后错误消失了。

I had the same issue and solve it like this:我有同样的问题并像这样解决它:

First: Updating Nx to version 13.8.5 .第一:将 Nx 更新到13.8.5版本。 Do as below:执行以下操作:

  1. Run command: nx migrate @nrwl/workspace@13.8.5运行命令: nx migrate @nrwl/workspace@13.8.5
  2. Run command: npm install运行命令: npm install
  3. Run command: nx migrate --run-migrations运行命令: nx migrate --run-migrations
  4. Remove "migrations.json" file in nx workspace root directory删除 nx 工作区根目录中的“migrations.json”文件

Second: Re-install npm globally based on nx version 13.8.5.二:基于nx 13.8.5版本全局重新安装npm。 Do as below:执行以下操作:

  1. Run command: npm i -g nx@13.8.5运行命令: npm i -g nx@13.8.5

I don't know why it's related to GIT but yes, having too many uncommitted files is the main cause of the problem.我不知道为什么它与 GIT 相关,但是是的,有太多未提交的文件是问题的主要原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在javascript中修复“错误:生成ENAMETOOLONG”(可能由jq引起)? - How to fix “Error: spawn ENAMETOOLONG” (probably cause by jq) in javascript? 错误:生成 ENAMETOOLONG,字符串太长 - Error: spawn ENAMETOOLONG , string is too long 指定生成器名称(例如,nx generate @nrwl/workspace:library)--Angular - Specify the generator name (e.g., nx generate @nrwl/workspace:library)--Angular 如何修复 travis 上的“未捕获错误:生成... EACCES” - how to fix 'Uncaught Error: spawn ... EACCES' on travis Node.JS 生成 Python 以处理二进制图像给出错误“节点错误生成 ENAMETOOLONG” - Node.JS spawning Python to process binary image gives error 'node error spawn ENAMETOOLONG' 如何修复错误:在Windows 10中生成npm ENOENT? - How to fix Error: spawn npm ENOENT in windows 10? 如何在 nx 工作区中将 env 变量传递给客户端? - How to pass env variable to client side in a nx workspace? NX 工作区,如何使用 cli 更改 Angular 应用程序名称? - NX workspace, how to change an Angular app name with the the cli? Grunt phpcs警告:使用watch进行文件更改时会生成ENAMETOOLONG - Grunt phpcs Warning: spawn ENAMETOOLONG when use watch for file changes Nrwl Nx React 在构建索引中自定义 static 路径。html - Nrwl Nx React customize static paths in build index.html
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM