Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 无法创建nx工作区_Node.js_Npx - Fatal编程技术网

Node.js 无法创建nx工作区

Node.js 无法创建nx工作区,node.js,npx,Node.js,Npx,我是NX的新手,甚至是NodeJS生态系统的新手。当我发现构建全堆栈应用程序开发的有趣工具时,我试了一下。但是我在创建nx工作区的第一步总是失败。不正确,我正在Windows Pro 64位上使用节点版本14.16 LTS和npm版本6.14.11。以下是错误: C:\Projects>npx create-nx-workspace --preset=angular ? Workspace name (e.g., org name) hw ? Application nam

我是NX的新手,甚至是NodeJS生态系统的新手。当我发现构建全堆栈应用程序开发的有趣工具时,我试了一下。但是我在创建nx工作区的第一步总是失败。不正确,我正在Windows Pro 64位上使用节点版本14.16 LTS和npm版本6.14.11。以下是错误:

    C:\Projects>npx create-nx-workspace --preset=angular
? Workspace name (e.g., org name)     hw
? Application name                    shop
? Default stylesheet format           CSS
? Default linter                      ESLint [ Modern linting tool ]
? Use Nx Cloud? (It's free and doesn't require registration.) No

>  NX  Nx is creating your workspace.

  To make sure the command works reliably in all environments, and that the preset is applied correctly,
  Nx will run "npm install" several times. Please wait.

added 229 packages from 170 contributors and audited 230 packages in 9.112s

32 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

- Creating your workspace
>  NX   ERROR  Something went wrong. Rerunning the command with verbose logging.

Failed to format: hw\angular.json
TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
    at Function.from (buffer.js:333:9)
    at FsTree.write (C:\Users\PTGENTS\AppData\Local\Temp\tmp-11296frnzjs2oVb4Z\node_modules\@nrwl\tao\src\shared\tree.js:35:20)
    at writeJson (C:\Users\PTGENTS\AppData\Local\Temp\tmp-11296frnzjs2oVb4Z\node_modules\@nrwl\devkit\src\utils\json.js:32:10)
    at Object.updateJson (C:\Users\PTGENTS\AppData\Local\Temp\tmp-11296frnzjs2oVb4Z\node_modules\@nrwl\devkit\src\utils\json.js:44:5)
    at formatWorkspaceJson (C:\Users\PTGENTS\AppData\Local\Temp\tmp-11296frnzjs2oVb4Z\node_modules\@nrwl\workspace\src\generators\workspace\workspace.js:53:18)
    at Object.<anonymous> (C:\Users\PTGENTS\AppData\Local\Temp\tmp-11296frnzjs2oVb4Z\node_modules\@nrwl\workspace\src\generators\workspace\workspace.js:78:9)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\PTGENTS\AppData\Local\Temp\tmp-11296frnzjs2oVb4Z\node_modules\tslib\tslib.js:114:62) {
  code: 'ERR_INVALID_ARG_TYPE'
}
UPDATE hw/nx.json
UPDATE hw/package.json
UPDATE hw/.vscode/extensions.json
UPDATE hw/angular.json

> hw@0.0.0 postinstall C:\Projects\hw
> node ./decorate-angular-cli.js


>  NX  Angular CLI has been decorated to enable computation caching.

npm WARN @cypress/webpack-preprocessor@4.1.5 requires a peer of webpack@^4.18.1 but none is installed. You must install peer dependencies yourself.
npm WARN @nrwl/cypress@11.6.1 requires a peer of cypress@>= 3 < 7 but none is installed. You must install peer dependencies yourself.
npm WARN babel-loader@8.2.2 requires a peer of webpack@>=2 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

removed 1506 packages and audited 799 packages in 21.916s

56 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

MergeConflictException [Error]: A merge conflicted on path "/apps/shop/tsconfig.editor.json".
    at C:\Projects\hw\node_modules\@angular-devkit\schematics\src\tree\host-tree.js:142:35
    at Array.forEach (<anonymous>)
    at HostTree.merge (C:\Projects\hw\node_modules\@angular-devkit\schematics\src\tree\host-tree.js:131:23)
    at MapSubscriber.project (C:\Projects\hw\node_modules\@angular-devkit\schematics\src\rules\base.js:54:91)
    at MapSubscriber._next (C:\Projects\hw\node_modules\rxjs\internal\operators\map.js:49:35)
    at MapSubscriber.Subscriber.next (C:\Projects\hw\node_modules\rxjs\internal\Subscriber.js:66:18)
    at TapSubscriber._next (C:\Projects\hw\node_modules\rxjs\internal\operators\tap.js:65:26)
    at TapSubscriber.Subscriber.next (C:\Projects\hw\node_modules\rxjs\internal\Subscriber.js:66:18)
    at ThrowIfEmptySubscriber._next (C:\Projects\hw\node_modules\rxjs\internal\operators\throwIfEmpty.js:44:26)
    at ThrowIfEmptySubscriber.Subscriber.next (C:\Projects\hw\node_modules\rxjs\internal\Subscriber.js:66:18)
A merge conflicted on path "/apps/shop/tsconfig.editor.json".
Workspace creation failed, see above.
(node:11296) UnhandledPromiseRejectionWarning: Error: Command failed: npx tao new hw --preset=angular --no-interactive --appName=shop --style=css --linter=eslint --no-nxCloud --collection=@nrwl/workspace/collection.json --cli=angular --nxWorkspaceRoot="C:/Projects"
    at checkExecSyncError (child_process.js:616:11)
    at Object.execSync (child_process.js:652:15)
    at C:\Users\PTGENTS\AppData\Roaming\npm\node_modules\create-nx-workspace\bin\create-nx-workspace.js:424:29
    at Generator.throw (<anonymous>)
    at rejected (C:\Users\PTGENTS\AppData\Roaming\npm\node_modules\create-nx-workspace\node_modules\tslib\tslib.js:113:69)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11296) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:11296) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
C:\Projects>npx创建nx工作空间——预设=角度
? 工作区名称(如组织名称)hw
? 应用名称商店
? 默认样式表格式CSS
? 默认过梁ESLint[现代过梁工具]
? 使用Nx云?(这是免费的,不需要注册。)不
>NX正在创建您的工作区。
为确保该命令在所有环境中都能可靠工作,并确保预设正确应用,
Nx将多次运行“npm安装”。请稍等。
在9.112s中添加了来自170个贡献者的229个包和经审核的230个包
32个方案正在寻求资金
有关详细信息,请运行“npm基金”
发现0个漏洞
-创建您的工作区
>NX错误出了点问题。使用详细日志记录重新运行命令。
未能格式化:hw\angular.json
TypeError[ERR_INVALID_ARG_TYPE]:第一个参数的类型必须为string或Buffer、ArrayBuffer、Array或类似数组的对象的实例。接收未定义
在Function.from(buffer.js:333:9)
在FsTree.write(C:\Users\PTGENTS\AppData\Local\Temp\tmp-11296frnzjs2oVb4Z\node\u modules\@nrwl\tao\src\shared\tree.js:35:20)
在writeJson(C:\Users\PTGENTS\AppData\Local\Temp\tmp-11296frnzjs2oVb4Z\node\u modules\@nrwl\devkit\src\utils\json.js:32:10)
在Object.updateJson(C:\Users\PTGENTS\AppData\Local\Temp\tmp-11296frnzjs2oVb4Z\node\u modules\@nrwl\devkit\src\utils\json.js:44:5)
在formatWorkspaceJson(C:\Users\PTGENTS\AppData\Local\Temp\tmp-11296frnzjs2oVb4Z\node\u modules\@nrwl\workspace\src\generators\workspace\workspace.js:53:18)
反对。(C:\Users\PTGENTS\AppData\Local\Temp\tmp-11296frnzjs2oVb4Z\node\u modules\@nrwl\workspace\src\generators\workspace\workspace.js:78:9)
在Generator.next()处
完成时(C:\Users\PTGENTS\AppData\Local\Temp\tmp-11296frnzjs2oVb4Z\node\u modules\tslib\tslib.js:114:62){
代码:“错误\无效\参数\类型”
}
更新hw/nx.json
更新hw/package.json
更新hw/.vscode/extensions.json
更新hw/angular.json
> hw@0.0.0安装后C:\Projects\hw
>节点。/decoration-angular-cli.js
>NX Angular CLI已修饰为启用计算缓存。
npm警告@cypress/网页包-preprocessor@4.1.5需要webpack@^4.18.1的对等计算机,但未安装任何计算机。您必须自己安装对等依赖项。
npm警告@nrwl/cypress@11.6.1需要cypress@>=3<7的对等机,但未安装任何对等机。您必须自己安装对等依赖项。
巴别塔-loader@8.2.2需要webpack@>=2的对等方,但未安装任何对等方。您必须自己安装对等依赖项。
npm警告可选跳过可选依赖项:fsevents@2.3.2(节点\u模块\fsevents):
npm WARN notsup跳过可选依赖项:不支持的平台fsevents@2.3.2:通缉{“os”:“达尔文”,“拱门”:“任何”}(当前:{“os”:“win32”,“拱门”:“x64”})
在21.916s中删除了1506个包和审核的799个包
56个方案正在寻求资金
有关详细信息,请运行“npm基金”
发现0个漏洞
MergeConflictException[错误]:路径“/apps/shop/tsconfig.editor.json”上的合并冲突。
在C:\Projects\hw\node\u modules\@angular devkit\schematics\src\tree\host tree.js:142:35
在Array.forEach()处
在HostTree.merge(C:\Projects\hw\node\u modules\@angular devkit\schematics\src\tree\host tree.js:131:23)
在MapSubscriber.project(C:\Projects\hw\node\u modules\@angular devkit\schematics\src\rules\base.js:54:91)
在MapSubscriber.\u下一步(C:\Projects\hw\node\u modules\rxjs\internal\operators\map.js:49:35)
在MapSubscriber.Subscriber.next(C:\Projects\hw\node\u modules\rxjs\internal\Subscriber.js:66:18)
在TapSubscriber.\u下一步(C:\Projects\hw\node\u modules\rxjs\internal\operators\tap.js:65:26)
在TapSubscriber.Subscriber.next(C:\Projects\hw\node\u modules\rxjs\internal\Subscriber.js:66:18)
在ThrowIfEmptySubscriber.\u下一步(C:\Projects\hw\node\u modules\rxjs\internal\operators\throwIfEmpty.js:44:26)
在ThrowIfEmptySubscriber.Subscriber.next(C:\Projects\hw\node\u modules\rxjs\internal\Subscriber.js:66:18)
路径“/apps/shop/tsconfig.editor.json”上的合并冲突。
工作区创建失败,请参见上文。
(节点:11296)未经处理的PromisejectionWarning:错误:命令失败:npx tao new hw--preset=ANGUAL--no interactive--appName=shop--style=css--linter=eslint--no nxCloud--collection=@nrwl/workspace/collection.json--cli=ANGUAL--nxWorkspaceRoot=“C:/Projects”
在checkExecSyncError(child_process.js:616:11)
在Object.execSync(child_process.js:652:15)
在C:\Users\PTGENTS\AppData\Roaming\npm\node\u modules\create nx workspace\bin\create nx workspace.js:424:29
在发电机处。投掷()
被拒绝时(C:\Users\PTGENTS\AppData\Roaming\npm\node\u modules\create nx workspace\node\u modules\tslib\tslib.js:113:69)
在处理和拒绝时(内部/process/task_queues.js:93:5)
(使用`node--trace warnings…`显示警告的创建位置)
(节点:11296)未处理的PromisejectionWarning:未处理的承诺拒绝。此错误源于在没有catch块的异步函数中抛出,或者拒绝未使用.catch()处理的承诺。要在未处理的承诺拒绝时终止节点进程,请使用CLI标志“---unhandled rejections=strict”(请参阅https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (拒绝id:1)
(节点:11296)[DEP0018]弃用警告:未处理的承诺拒绝已弃用。将来,未处理的承诺拒绝将使用非零退出代码终止Node.js进程。

任何人都可以帮助我或给我一个线索吗?

我在第一次做这件事时也遇到过同样的问题。但后来成功了。 请