Skip to content

null error on component build #6

@Sacramentix

Description

@Sacramentix

There is a problem with the now-cli develop command, You need to add a null safety check:

You can't retrieve the name of a package if this one is undefined

TypeError: Cannot destructure property 'name' of 'u(...)' as it is undefined.

To fix it, go to the @servicenow/ui-build-component-utils lib then go to the file is-component.js

    module.exports = r => {
        const a = readPackageConfig(r);
        const l = c(a, "build");
        if ("library" === l || "distribution" === l) return !1;
        if ("app:dynamic" === e && i(a, "uxFramework")) return !o(c(a, "uxFramework.components", {}));
        const d = s(r, ".builderrc");
        const p = n(d) && t(d, "utf8");
        const {
            name: m
        } = u(r) /*Add this in case u is undefined */ || {name: ""};
        return 0 === m.indexOf("sn-component-") || p && (-1 !== p.indexOf("@servicenow/cli-component-archetype") || -1 !== p.indexOf("@tectonic/component-archetype") || -1 !== p.indexOf("sn-seismic-archetype"))
    };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions