Skip to content

oc package fails to find compiler in npm workspaces #1469

@CarlH-AccessGroup

Description

@CarlH-AccessGroup

Command : tsc --noEmit && oc package .

Key points:

  • oc package checks the local workspace's node_modules for oc-template-esm-compiler

  • With npm workspaces, this package gets hoisted to the root node_modules

  • oc then tries to npm install it into the local node_modules, which also fails because npm workspaces manages that directory

  • The fix should be to use Node's standard require.resolve() which naturally traverses parent node_modules directories, rather than checking only the local one

Workaround:

  • Creating directory junctions/symlinks from each workspace's node_modules to the hoisted package as part of a npm postinstall script

Note: It looks like there is some handling where the package command tries to install the compiler if it can't find it in the local node_modules but in my scenario this would always fail to install.

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