Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to build project's that have buildable dependencies without package.json's #8707

Closed
pemsbr opened this issue Jan 26, 2022 · 5 comments · Fixed by #9466
Closed

Not able to build project's that have buildable dependencies without package.json's #8707

pemsbr opened this issue Jan 26, 2022 · 5 comments · Fixed by #9466
Labels

Comments

@pemsbr
Copy link
Contributor

pemsbr commented Jan 26, 2022

Current Behavior

calculateProjectDependencies fails when buildable dependencies don't have package.json's

Expected Behavior

Build should work as expected.

Steps to Reproduce

  1. Create a buildable @nrwl/js:tsc library named target-lib
  2. Create a buildable library that doesn't have a package.json named dep-lib (e.g., create a dotnet project using the nx-dotnet plugin)
  3. Set dep-lib as an implicit dependency of target-lib
// target-lib's project.json
"implicitDependencies": ["dep-lib"]
  1. Invoke nx build target-lib

Failure Logs

ENOENT: no such file or directory, open '/Users/pedro/Developer/demo/libs/dep-lib/package.json'
Error: ENOENT: no such file or directory, open '/Users/pedro/Developer/demo/libs/dep-lib/package.json'
    at Object.openSync (node:fs:585:3)
    at readFileSync (node:fs:453:35)
    at readJsonFile (/Users/pedro/Developer/demo/node_modules/.pnpm/@[email protected]/node_modules/@nrwl/tao/src/utils/fileutils.js:16:43)
    at /Users/pedro/Developer/demo/node_modules/.pnpm/@[email protected]_77aa66af867b7a7d7364671ca12d39bb/node_modules/@nrwl/workspace/src/utilities/buildable-libs-utils.js:26:66
    at Array.map (<anonymous>)
    at calculateProjectDependencies (/Users/pedro/Developer/demo/node_modules/.pnpm/@[email protected]_77aa66af867b7a7d7364671ca12d39bb/node_modules/@nrwl/workspace/src/utilities/buildable-libs-utils.js:22:10)
    at checkDependencies (/Users/pedro/Developer/demo/node_modules/.pnpm/@[email protected]_77aa66af867b7a7d7364671ca12d39bb/node_modules/@nrwl/js/src/utils/check-dependencies.js:9:120)
    at tscExecutor_1 (/Users/pedro/Developer/demo/node_modules/.pnpm/@[email protected]_77aa66af867b7a7d7364671ca12d39bb/node_modules/@nrwl/js/src/executors/tsc/tsc.impl.js:30:89)
    at tscExecutor_1.next (<anonymous>)
    at resume (/Users/pedro/Developer/demo/node_modules/.pnpm/[email protected]/node_modules/tslib/tslib.js:225:48)

Environment

// nx.json
"targetDependencies": {
    "build": [
      {
        "target": "build",
        "projects": "dependencies"
      }
    ]
  },
Node : 17.3.1
   OS   : darwin arm64
   pnpm : 6.28.0
   
   nx : 13.5.1
   @nrwl/angular : undefined
   @nrwl/cli : 13.5.1
   @nrwl/cypress : 13.5.1
   @nrwl/detox : undefined
   @nrwl/devkit : 13.5.1
   @nrwl/eslint-plugin-nx : 13.5.1
   @nrwl/express : undefined
   @nrwl/jest : 13.5.1
   @nrwl/js : 13.5.1
   @nrwl/linter : 13.5.1
   @nrwl/nest : undefined
   @nrwl/next : undefined
   @nrwl/node : undefined
   @nrwl/nx-cloud : undefined
   @nrwl/react : 13.5.1
   @nrwl/react-native : undefined
   @nrwl/schematics : undefined
   @nrwl/storybook : 13.5.1
   @nrwl/tao : 13.5.1
   @nrwl/web : 13.5.1
   @nrwl/workspace : 13.5.1
   typescript : 4.5.5
   rxjs : 7.5.2
   ---------------------------------------
   Community plugins:
         @nx-dotnet/core: 1.8.0

Context

const libPackageJson = readJsonFile(
join(root, depNode.data.root, 'package.json')
);

@FrozenPandaz FrozenPandaz added the scope: core core nx functionality label Jan 29, 2022
@pemsbr
Copy link
Contributor Author

pemsbr commented Feb 8, 2022

@AgentEnder is this something that can be fixed on nx-dotnet's side?

@AgentEnder
Copy link
Member

Not really, we should be checking that the lib actually has a package.json and skipping it if it doesn't on the NX side, should be easy fix.

If you want to open a PR it looks like you've already identified the piece of code, and I could review.

@pemsbr
Copy link
Contributor Author

pemsbr commented Apr 8, 2022

hey @AgentEnder 👋 can we get this merged?

@AgentEnder
Copy link
Member

Hey, sorry. Yeah, let me take a look.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants