now-experience-component-examples icon indicating copy to clipboard operation
now-experience-component-examples copied to clipboard

null error on component build

Open Sacramentix opened this issue 4 years ago • 0 comments

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"))
    };

Sacramentix avatar Oct 28 '21 07:10 Sacramentix