Nx: create-nx-workspace nx 8.0 Ubuntu failing

Created on 30 May 2019  Â·  5Comments  Â·  Source: nrwl/nx

I just install angular/cli 8.0
sudo npm instal -g @angular/cli@latest
sudo npm install -g create-nx-workspace

on Ubuntu m/c

getting error

create-nx-workspace Hello8
Creating a sandbox with Nx...
ng new "Hello8" --collection=@nrwl/workspace
Could not find module "@nrwl/workspace" from [myfolder]

ng --version

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ â–³ \ | '_ \ / _| | | | |/ _ | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ __| |_|__, |__,_|_|__,_|_| ____|_____|___|
|___/

Angular CLI: 8.0.0
Node: 11.6.0
OS: linux x64
Angular:
...

Package Version

@angular-devkit/architect 0.800.0
@angular-devkit/core 8.0.0
@angular-devkit/schematics 8.0.0
@angular/cli 8.0.0
@schematics/angular 8.0.0
@schematics/update 0.800.0
rxjs 6.4.0

bug

Most helpful comment

And did it work?

All 5 comments

Hi, there's definitely an issue in the code which I've submitted a PR for. Sorry for the confusing error.

I'm using Pop!_OS (which is pretty close to ubuntu). This seems to somehow work in most cases despite the error in the code.

The only way which I am able to reproduce the issue is if I am in a directory which has a node_modules/.bin/ng which means i've installed @angular/cli there. It also can't be an @angular/cli generated project as then it will have a different error. Sometimes, I forget to pass -g when installing packages and it ends up in that directory but I never clean it up.

Can you please make sure that there is no node_modules directory in your cwd? To be extra safe, you can try to do the following:

mkdir temp
cd temp
npx create-nx-workspace@latest hello8

This should not be necessary but might help you get past your issue.

i created fresh new folder

mkdir ~/Angular8

cd ~/Angular8

and then ran

create-nx-workspace hello8

And did it work?

Fails on windows

npx: installed 53 in 6.136s
Creating a sandbox with Nx...
child_process.js:661
throw err;
^

Error: Command failed: npm install --silent
at checkExecSyncError (child_process.js:621:11)
at Object.execSync (child_process.js:658:15)
at Object. (C:\Users\HALLJ\AppData\Roaming\npm-cache_npx\15976node_modules\create-nx-workspacebin\create-nx-workspace.js:53:21)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
at internal/main/run_main_module.js:17:11 {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 18040,
stdout: null,
stderr: null
}

Just tried again with what you said and got

$ npx create-nx-workspace@latest hello8
npx: installed 53 in 5.421s
Creating a sandbox with Nx...
Command failed: npm install --silent

~/development 
➜ mkdir temp
cd temp
npx create-nx-workspace@latest hello8
npx: installed 142 in 9.005s

>  NX  Creating a sandbox...


>  NX  Running: ng new "hello8" --collection=@nrwl/workspace

An unhandled exception occurred: Could not find module "@nrwl/workspace" from "/home/duard/development/temp".
See "/tmp/ng-P3g0Ru/angular-errors.log" for further details.
Command failed: "/tmp/tmp-12398nAmqj891Bh0I/node_modules/.bin/ng" new "hello8" --collection=@nrwl/workspace

Was this page helpful?
0 / 5 - 0 ratings