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.

@nrwl/js:library — no root entry in project.json causes nx to throw an error

See original GitHub issue

Current Behavior

Running npx nx generate @nrwl/js:library myTestLib --importPath=@mycompany/myTestLib --publishable --tags=myTestLib to create a non-angular library in an angular workspace causes nx to throw an error. The generated project.json is missing the { root: "myTestLib" } entry.

Expected Behavior

The @nrwl/js generator scaffolds the json to have a root field containing the lib name.

Steps to Reproduce

Run npx nx generate @nrwl/workspace:workspace-generator test --no-interactive to create a workspace Run npx nx generate @nrwl/angular:application testapp --tags=mytestapp --no-interactive to create an angular app Run npx nx generate @nrwl/js:library testlib --tags=testlib --no-interactive to create a new typescript library. Now try to run nx serve or nx build to see the build failing with:

Failure Logs

node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^
{
  stack: "TypeError: Cannot read properties of undefined (reading 'endsWith')\n" +
    '    at createProjectRootMappings (/Users/**/**/node_modules/@nrwl/workspace/src/core/file-map-utils.js:12:38)\n' +
    '    at createProjectFileMap (/Users/**/**/node_modules/@nrwl/workspace/src/core/file-map-utils.js:27:33)\n' +
    '    at /Users/**/Documents/**/node_modules/@nrwl/workspace/src/core/project-graph/daemon/server/project-graph-incremental-recomputation.js:97:65\n' +
    '    at Generator.next (<anonymous>)\n' +
    '    at fulfilled (/Users/**/Documents/**/node_modules/tslib/tslib.js:115:62)\n' +
    '    at processTicksAndRejections (node:internal/process/task_queues:96:5)',
  message: "Cannot read properties of undefined (reading 'endsWith')\n" +
    '\n' +
    'Because of the error the Nx daemon process has exited. The next Nx command is going to restart the daemon process.\n' +
    'If the error persists, please run "nx reset".'
}

Environment

Node : 16.15.0
   OS   : darwin arm64
   npm  : 8.5.5
   
   nx : 13.9.5
   @nrwl/angular : 13.9.5
   @nrwl/cypress : 13.9.5
   @nrwl/detox : Not Found
   @nrwl/devkit : 13.9.5
   @nrwl/eslint-plugin-nx : 13.9.5
   @nrwl/express : Not Found
   @nrwl/jest : 13.9.5
   @nrwl/js : 14.1.4
   @nrwl/linter : 13.9.5
   @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 : 13.9.5
   @nrwl/web : Not Found
   @nrwl/workspace : 13.9.5
   typescript : 4.5.5
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:
         nx-stylelint: 13.3.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
AgentEndercommented, May 9, 2022

Hey @oliverkierepka , it may be unrelated, but some of your @nrwl/* packages don’t line up with the version of nx you have installed. Aside from @nrwl/nx-cloud, all packages under the nrwl scope should generally be set up with the same version.

Can you correct this and check that the issue still reproduces? An easy way to fix this would be to run nx migrate {v}, where v is the version of nx you have installed. Alternatively, updating to latest with nx migrate latest would also work.

0reactions
JonathanWilburcommented, Jul 30, 2022

Nevermind my previous comment. I accidentally commented on the wrong issue. 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

nrwl NX error on generating nest library NX 'project.json' files ...
I am getting this error on running @nrwl/nest library generator command. I can't figure out the issue. Plz help.. > NX 'project.json' files...
Read more >
Project Configuration - Nx
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 >
Fixing missing project.json error in old csproj format
The file in question seems to named project.assets.json. Deleting these in all subfolders seems to do the trick. Run, from the root of...
Read more >
HTTP status and error codes for JSON | Cloud Storage
The following is an example of an error response you receive if you try to list the buckets for a project but do...
Read more >
nrwl-nx/community - Gitter
Error : [BABEL] Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "<root ...
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