question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: ENOENT: no such file or directory, open '~/tools/tsconfig.tools.json'

See original GitHub issue

Custom generator fails with following error:

Current Behavior

> npx nx workspace-generator new-package some
nx workspace-generator [name]

Runs a workspace generator from the tools/generators directory

Positionals:
  name  The name of your generator                                                                                [string] [required]

Options:
  --help             Show help                                                                                              [boolean]
  --version          Show version number                                                                                    [boolean]
  --list-generators  List the available workspace-generators                                                                [boolean]

Find more information and examples at https://nx.dev/cli/workspace-generator

Error: ENOENT: no such file or directory, open '/workspace/reatom/tools/tsconfig.tools.json'
    at Object.openSync (node:fs:585:3)
    at readFileSync (node:fs:453:35)
    at readJsonFile (/workspace/reatom/node_modules/nx/src/utils/fileutils.js:21:43)
    at toolsTsConfig (/workspace/reatom/node_modules/nx/src/command-line/workspace-generators.js:93:41)
    at getToolsOutDir (/workspace/reatom/node_modules/nx/src/command-line/workspace-generators.js:49:20)
    at compileTools (/workspace/reatom/node_modules/nx/src/command-line/workspace-generators.js:40:25)
    at Object.<anonymous> (/workspace/reatom/node_modules/nx/src/command-line/workspace-generators.js:26:24)
    at Generator.next (<anonymous>)
    at /workspace/reatom/node_modules/tslib/tslib.js:118:75
    at new Promise (<anonymous>) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/workspace/reatom/tools/tsconfig.tools.json'
}

Expected Behavior

A new folder and files generated.

Steps to Reproduce

  1. Go to the repo: https://github.com/artalar/reatom/tree/233ac496bb20bd0973479547142109a0453bda3d
  2. Clone it or open by gitpod.io
  3. npm i
  4. npx nx workspace-generator new-package some

Failure Logs

Environment

Personal MacBook Air:

Node : 16.13.1
OS   : darwin arm64
npm  : 8.1.2

nx : 14.1.9
@nrwl/angular : Not Found
@nrwl/cypress : Not Found
@nrwl/detox : Not Found
@nrwl/devkit : 14.1.9
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 14.1.9
@nrwl/js : Not Found
@nrwl/linter : 14.1.9
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : Not Found
@nrwl/web : Not Found
@nrwl/workspace : 14.1.9
typescript : 4.6.4
---------------------------------------
Community plugins:
  @ngrx/store: 13.2.0

Gitpod instance:

   Node : 16.15.0
   OS   : linux x64
   npm  : 8.5.5
   
   nx : 14.1.9
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.1.9
   @nrwl/eslint-plugin-nx : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 14.1.9
   @nrwl/js : Not Found
   @nrwl/linter : 14.1.9
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 14.1.9
   typescript : 4.6.4
   ---------------------------------------
   Community plugins:
         @ngrx/store: 13.2.0

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
pmrotulecommented, Aug 25, 2022

@dan-cooke Oh now I understand where I got confused, sorry. I’m creating a generator to create a new package and somehow I thought this tsconfig was the one copied to the new package (which doesn’t make sense now that I think about it). So now that I used the exact same config used in the example repo, it worked! Thanks for helping out 🙏

I removed the extends property so I ended up with the following config:

tools/tsconfig.tools.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "outDir": "../dist/out-tsc/tools",
    "rootDir": ".",
    "noUnusedLocals": true,
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "types": ["node"],
    "typeRoots": ["node_modules/@types"],
    "lib": ["es2017", "dom"],
    "skipLibCheck": true,
    "skipDefaultLibCheck": true,
    "baseUrl": "."
  },
  "exclude": ["node_modules", "tmp"],
  "include": ["**/*.ts"]
}

This tsconfig.tools.json should definitely be added when running nx generate @nrwl/workspace:workspace-generator my-generator to avoid confusion.

1reaction
artalarcommented, Jul 10, 2022

I’m trying to fix it, what does that even mean???

image
Read more comments on GitHub >

github_iconTop Results From Across the Web

no such file or directory in tsconfig.app.json using angular 4?
Show activity on this post. Check the path for the tsconfig property in the angular. json file. Correcting that path should fix this...
Read more >
Project Configuration
json files are located in each project's folder. Nx merges the two files to get each project's configuration. The following configuration creates build...
Read more >
no such file or directory, open \package.json install bootstrap ...
✓ Solved: npm WARN saveError ENOENT : no such file or directory, open \package. json install bootstrap.
Read more >
nrwl-nx/community - Gitter
Hi Guys, I am a newbie to cypress and nrwl nx style. I wanted to set my env variable defined in the cypress.json...
Read more >
Parsing Error: Cannot read file 'tsconfig.json'
Another cause of the "Parsing Error: Cannot read file 'tsconfig.json'" is when we open our code editor in a different directory than the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found