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

@nrwl/nx-plugin fails when life isn't perfect #9877

Closed
airtonix opened this issue Apr 19, 2022 · 4 comments · Fixed by #9903
Closed

@nrwl/nx-plugin fails when life isn't perfect #9877

airtonix opened this issue Apr 19, 2022 · 4 comments · Fixed by #9903

Comments

@airtonix
Copy link

airtonix commented Apr 19, 2022

So i'm trying to create a executor in my monorepo... and this happens:
image

x just nx report                                     
nx report

 >  NX   Report complete - copy this into the issue template

   Node : 17.9.0
   OS   : linux x64
   pnpm : 6.32.8
   
   nx : 13.10.2
   @nrwl/angular : Not Found
   @nrwl/cypress : 13.10.2
   @nrwl/detox : Not Found
   @nrwl/devkit : 13.10.2
   @nrwl/eslint-plugin-nx : 13.10.2
   @nrwl/express : Not Found
   @nrwl/jest : 13.10.2
   @nrwl/js : 13.10.2
   @nrwl/linter : 13.10.2
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : 13.10.2
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : 13.10.2
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 13.10.2
   @nrwl/web : Not Found
   @nrwl/workspace : 13.10.2
   typescript : 4.6.3
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:

image

We should really be validating that all expected things exist before assuming that they do:

function sortObjectByKeys(obj) {
    return Object.keys(obj)

which is called by :

            json.devDependencies = sortObjectByKeys(json.devDependencies);

shouldn't this be :

function sortObjectByKeys(obj) {
    if (!obj || Array.isArray(obj)) return
    return Object.keys(obj)
        .sort()
        .reduce((result, key) => {
        return Object.assign(Object.assign({}, result), { [key]: obj[key] });
    }, {});
}

how did this get through code review???!?!

@airtonix
Copy link
Author

for the record, after that fix:

image

@airtonix
Copy link
Author

and as an aside:

we isn't it standard policy in something as configuration heavy as NX that all tooling that uses it have the benfit of all things be validated that they exist before accessing them?

@gioragutt
Copy link
Contributor

So what exactly is missing in your project? That you don't have devDependencies and it's trying to call Object.keys(undefined)?

@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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants