nrwl / nx

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

npx create-nx-workspace results in Error: Cannot find module 'tslib' #3529

Closed mikelgo closed 4 years ago

mikelgo commented 4 years ago

Current Behavior

npx create-nx-workspace@latest/ npx create-nx-workspace fail using both cmd and powershell on Windows 10.

Expected Behavior

It should create a new nx-workspace

Failure Logs

Creating a sandbox with Nx...
new kniffel-app  --preset="empty" --interactive=false --collection=@nrwl/workspace
internal/modules/cjs/loader.js:968
  throw err;
  ^
Error: Cannot find module 'tslib'
Require stack:
- C:\Users\mgons\AppData\Local\Temp\tmp-3020ck4Sr83QEb9M\node_modules\.registry.npmjs.org\@nrwl\tao\10.0.12\node_modules\@nrwl\tao\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\mgons\AppData\Local\Temp\tmp-3020ck4Sr83QEb9M\node_modules\.registry.npmjs.org\@nrwl\tao\10.0.12\node_modules\@nrwl\tao\index.js:5:17)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\mgons\\AppData\\Local\\Temp\\tmp-3020ck4Sr83QEb9M\\node_modules\\.registry.npmjs.org\\@nrwl\\tao\\10.0.12\\node_modules\\@nrwl\\tao\\index.js'
  ]
}
(node:3020) UnhandledPromiseRejectionWarning: Error: Command failed: "C:\Users\mgons\AppData\Local\Temp\tmp-3020ck4Sr83QEb9M\node_modules\.bin\tao" new kniffel-app  --preset="empty" --interactive=false --collection=C:\Users\mgons\AppData\Local\Temp\tmp-3020ck4Sr83QEb9M\node_modules\@nrwl\workspace\collection.json
    at checkExecSyncError (child_process.js:630:11)
    at Object.execSync (child_process.js:666:15)
    at createApp (C:\Users\mgons\AppData\Roaming\npm-cache\_npx\3020\node_modules\create-nx-workspace\bin\create-nx-workspace.js:367:21)
    at C:\Users\mgons\AppData\Roaming\npm-cache\_npx\3020\node_modules\create-nx-workspace\bin\create-nx-workspace.js:85:25
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3020) 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:3020) [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.

Environment

Windows 10 NodeJs v. 12.18.3-LTS npm and npx both 6.14.7 powershell v 5.1 build 18362

iorran commented 4 years ago

Have you tried with an empty workspace preset?

mikelgo commented 4 years ago

@iorran I tried several things. I tried npx create-nx-workspace and then choosing the empty option as well as npx create-nx-workspace --preset=empty.

I also tried non empty presets - all with the same result

iorran commented 4 years ago

@mikelgo have you tried to clean your cache? npm/yarn

mikelgo commented 4 years ago

@iorran yes, I also ran npm cache clean and npm cache verify. I also re-installed my global nx package

mandarini commented 4 years ago

Hi there @mikelgo ! Unfortunately, I could not reproduce your issue. I tried it on Windows 10 cmd with the same setup and versions as yours: nx_3

I could create both an empty workspace, and one with a default Angular app without an issue: nx_1 nx_2

Off the top of my head, maybe there's an issue with your Node installation. I understand that you have already tried cleaning your cache and you have the latest version, but just to be sure, I would still try to remove and reinstall node (here are some good instructions on how to do so: https://stackoverflow.com/questions/20711240/how-to-completely-remove-node-js-from-windows).

If everything fails again, please let me know!

Thanks again! :)

mikelgo commented 4 years ago

Hey @mandarini :) Thank you very much for your effort to reproduce my issue. Sorry that you can not reproduce it (or in the end it is good because nothing needs to be fixed :-P).

Your tip with reinstalling node did the job! I just re-installed node according to the guide provided in the link and it worked! Now I'm again able to create nx-workspaces.

I re-installed node before as well, but I guess somehow I missed there a part to completely remove it and therefore it didn`t work.

mandarini commented 4 years ago

Yey!! I'm so happy it worked and you can use Nx normally now!! :D

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.