nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.63k stars 2.36k forks source link

create-nx-workspace is not working #232

Closed Gopans closed 6 years ago

Gopans commented 6 years ago

create-nx-workspace fails at ng new <app name> --collection=@nrwl/schematics with the message core_1.PriorityQueue is not a constructor

aaronchar commented 6 years ago

Seeing the same issue here.

MSakamaki commented 6 years ago

I worked by partially rewriting the installed create-nx-workspace command.

seems to be a problem that @angular-devkit/core@0.0.28 is referenced in the sunbox.

https://github.com/nrwl/nx/blob/master/packages/schematics/bin/create-nx-workspace.ts

writeFileSync(
  path.join(tmpDir, 'package.json'),
  JSON.stringify({
    dependencies: {
      '@nrwl/schematics': nxVersion,
      '@angular/cli': `file:${path.join(
        path.dirname(__dirname),
        'src',
        'collection',
        'application',
        'files',
        '__directory__',
        '.angular_cli165.tgz'
      )}`,
      '@angular-devkit/core': '^0.0.28' // <-- rewrite ^0.0.29
    }
  })
);
val-samonte commented 6 years ago

Not sure if this related to angular-cli issue, but they are getting the same error. Have yet to investigate but will put a reference here. https://github.com/angular/angular-cli/issues/9374

val-samonte commented 6 years ago

On my end, I am getting a similar error:


ng new "Enterprise" --collection=@nrwl/schematics

core_1.PriorityQueue is not a constructor
TypeError: core_1.PriorityQueue is not a constructor
    at new TaskScheduler (C:\Users\val\AppData\Local\Temp\tmp-15928M0elARTc9ksF\node_modules\@angular-devkit\schematics\src\engine\task.js:20:23)
    at SchematicEngine.createContext (C:\Users\val\AppData\Local\Temp\tmp-15928M0elARTc9ksF\node_modules\@angular-devkit\schematics\src\engine\engine.js:81:31)
    at SchematicImpl.call (C:\Users\val\AppData\Local\Temp\tmp-15928M0elARTc9ksF\node_modules\@angular-devkit\schematics\src\engine\schematic.js:35:38)
    at Promise (C:\Users\val\AppData\Local\Temp\tmp-15928M0elARTc9ksF\node_modules\@angular\cli\tasks\schematic-run.js:73:23)
    at Promise (<anonymous>)
    at Class.run (C:\Users\val\AppData\Local\Temp\tmp-15928M0elARTc9ksF\node_modules\@angular\cli\tasks\schematic-run.js:72:16)
    at Class.run (C:\Users\val\AppData\Local\Temp\tmp-15928M0elARTc9ksF\node_modules\@angular\cli\tasks\init.js:71:33)
    at Class.run (C:\Users\val\AppData\Local\Temp\tmp-15928M0elARTc9ksF\node_modules\@angular\cli\commands\new.js:134:25)
    at resolve (C:\Users\val\AppData\Local\Temp\tmp-15928M0elARTc9ksF\node_modules\@angular\cli\ember-cli\lib\models\command.js:261:20)
    at Promise (<anonymous>)
child_process.js:635
    throw err;
    ^

Error: Command failed: C:\Users\val\AppData\Local\Temp\tmp-15928M0elARTc9ksF\node_modules\.bin\ng new "Enterprise" --collection=@nrwl/schematics
    at checkExecSyncError (child_process.js:592:13)
    at Object.execSync (child_process.js:632:13)
    at Object.<anonymous> (C:\Users\val\AppData\Local\Yarn\config\global\node_modules\@nrwl\schematics\bin\create-nx-workspace.js:40:17)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Function.Module.runMain (module.js:665:10)
    at startup (bootstrap_node.js:187:16)
jfc37 commented 6 years ago

I had the same issue. After updating to 0.7.0-beta.1 , I was able to successfully run the create-nx-workspace command

npm remove -g @nrwl/schematics npm install -g @nrwl/schematics@0.7.0-beta.1

Hopefully that work around helps others

ayush987goyal commented 6 years ago

Issue persists with @nrwl/schematics@0.7.0-beta.3 and @angular/cli@1.6.6

andrewIQXCorp commented 6 years ago

I got it working by following @MSakamaki instructions. And then within the workspace updating @angular-devkit/core to version 0.0.29.

That seemed to get everything up and running.

xeax commented 6 years ago

Same problem!

> ng new "mc-workspace" --collection=@nrwl/schematics core_1.PriorityQueue is not a constructor TypeError: core_1.PriorityQueue is not a constructor

@angular/cli@1.6.6
@nrwl/schematics@0.6.19
Gopans commented 6 years ago

I was able to set up the workspace following @jfc37 instructions. Able to create apps and libs.

nassimreb commented 6 years ago

Same problem when : ng new "NAME_PROJECT" --collection=@nrwl/schematics

zealitude commented 6 years ago

facing the same problem with the newest @nrwl/schematics@0.7.2

PS C:\wpn-xm\www\angular> ng new "project" --collection=@nrwl/schematics
Could not find module "@nrwl/schematics" from "C:\\wpn-xm\\www\\angular".
Error: Could not find module "@nrwl/schematics" from "C:\\wpn-xm\\www\\angular".
    at Object.resolve (C:\wpn-xm\www\angular\node_modules\@angular-devkit\core\node\resolve.js:140:11)
    at NodeModulesEngineHost._resolvePackageJson (C:\wpn-xm\www\angular\node_modules\@angular-devkit\schematics\tools\node-module-engine-host.js:22:21)
    at NodeModulesEngineHost._resolveCollectionPath (C:\wpn-xm\www\angular\node_modules\@angular-devkit\schematics\tools\node-module-engine-host.js:43:36)
    at NodeModulesEngineHost.createCollectionDescription (C:\wpn-xm\www\angular\node_modules\@angular-devkit\schematics\tools\file-system-engine-host-base.js:105:27)
    at SchematicEngine.createCollection (C:\wpn-xm\www\angular\node_modules\@angular-devkit\schematics\src\engine\engine.js:57:40)
    at Object.getCollection (C:\wpn-xm\www\angular\node_modules\@angular\cli\utilities\schematics.js:35:31)
    at Class.run (C:\wpn-xm\www\angular\node_modules\@angular\cli\tasks\schematic-get-options.js:11:41)
    at Class.beforeRun (C:\wpn-xm\www\angular\node_modules\@angular\cli\commands\new.js:91:31)
    at Promise.resolve.then (C:\wpn-xm\www\angular\node_modules\@angular\cli\ember-cli\lib\cli\cli.js:138:24)
    at <anonymous>
dereklin commented 6 years ago

Let's say I have a folder nrwl, inside this folder there are mulitple nx workspaces, some uses angular-cli 1.6.2.

When I run

create-nx-workspace nrwl-nx-workspace-v20180201

or

ng new "nrwl-nx-workspace-v20180201" --collection=@nrwl/schematics

It complains:

Your global Angular CLI version (1.6.7) is greater than your local
version (1.6.2). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
Could not find module "@nrwl/schematics" from "

Now I move to a folder that has no nx workspaces, the create-nx-workspace command works.

This is @nrwl/schematics@0.7.3

nthonymiller commented 6 years ago

I've encountered the same issue creating a nx workspace on my windows machine using @nrwl/nx@0.7.3

When I run create-nx-workspace support-ticket-suite or create-nx-workspace support-ticket-suite --npm-scope=suite The workspace is successfully created.

However, when I run create-nx-workspace support-ticket-suite --directory=ticket-system --npm-scope=suite

I get the following error:

create-nx-workspace support-ticket-suite --directory=ticket-system --npm-scope=suite
Creating a sandbox with the CLI and Nx Schematics...
Cached binary found at C:\Users\antho\AppData\Roaming\npm-cache\node-sass\4.7.2\win32-x64-59_binding.node
Binary found at C:\Users\antho\AppData\Local\Temp\tmp-21092ODTTDTvdQUCQ\node_modules\node-sass\vendor\win32-x64-59\binding.node
Testing binary
Binary is fine
added 1267 packages in 82.073s
ng new "support-ticket-suite" "--directory=ticket-system" "--npm-scope=suite" --collection=@nrwl/schematics
  create ticket-system/.angular_cli165.tgz (147722 bytes)
  create ticket-system/apps/.gitkeep (1 bytes)
  create ticket-system/karma.conf.js (1105 bytes)
  create ticket-system/libs/.gitkeep (0 bytes)
  create ticket-system/package.json (2425 bytes)
  create ticket-system/protractor.conf.js (886 bytes)
  create ticket-system/README.md (1871 bytes)
  create ticket-system/test.js (1033 bytes)
  create ticket-system/tsconfig.json (468 bytes)
  create ticket-system/tsconfig.spec.json (343 bytes)
  create ticket-system/tslint.json (2240 bytes)
  create ticket-system/.angular-cli.json (728 bytes)
  create ticket-system/.editorconfig (245 bytes)
  create ticket-system/.gitignore (516 bytes)
Successfully initialized git.
Project 'support-ticket-suite' successfully created.
child_process.js:614
    throw err;
    ^

Error: spawnSync C:\WINDOWS\system32\cmd.exe ENOENT
    at _errnoException (util.js:1031:13)
    at Object.spawnSync (internal/child_process.js:963:20)
    at spawnSync (child_process.js:560:24)
    at Object.execSync (child_process.js:606:13)
    at Object.<anonymous> (C:\Users\antho\AppData\Roaming\npm\node_modules\@nrwl\schematics\bin\create-nx-workspace.js:77:21)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)

This above error occurs and the setup of the workspace is incomplete.

ThomasBurleson commented 6 years ago

Can you confirm these errors when using Nx v0.8.0 ?

npm remove -g @nrwl/schematics
npm install -g @nrwl/schematics@0.8.0
cheindl commented 6 years ago

Yes, problem auf @amiller29au still persists also on my system:

@nrwl/schematics@0.8.0 @angular/cli@1.7.2 Ubuntu 16.04

nthonymiller commented 6 years ago

Yes the problem still persists with version 0.8.0

ThomasBurleson commented 6 years ago

@amiller29au - Understood. We will be addressing this soon.

vsavkin commented 6 years ago

Fixed here: https://github.com/nrwl/nx/commit/da9310e9dbb4eb3294200ca72bfa70b14faec2c2

meriturva commented 5 years ago

I just start a new workspace with version 7.1.0 and same issue! I guess issue has to be reopen! It is my first attempt to use Nx 😄

DWboutin commented 5 years ago

I can't make it work create-nx-workspace: command not found

$ node -v v10.9.0 $ npm -v 6.9.0

Screen Shot 2019-08-13 at 7 21 27 PM
yabozdar commented 4 years ago

It still doesn't work.

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.