Skip to content

Issues when running with npm workspaces #1347

@renestalder

Description

@renestalder

I am using Pattern Lab Node v5.15.0 on Linux, with Node v16.x.x, using a Twig Edition.

When using npm workspaces and try to run patternlab from the root project of the monorepo, Pattern Lab has problems to either resolve files or dependencies.

If somebody has more knowledge about the underlying logic that resolves the files here and can point out why this might happen, I could probably provide the fix.

Expected Behavior

Pattern Lab shouldn't make a difference in path resolving from whether it runs in the current folder or via workspaces.

Actual Behavior
[watch] build finished, watching for changes...
 (node:428811) [DEP0128] DeprecationWarning: Invalid 'main' field in '/Projects/my-company/code/my-website/node_modules/emitter-mixin/package.json' of 'y'. Please either fix that or report it to the module author
 (Use `node --trace-deprecation ...` to show where the warning was created)
 ⊙ patternlab → serve: Serving your files ...
 Pattern Lab Node v5.15.0
 No engines loaded! Something is seriously wrong.
 TypeError: Cannot read property 'findListItems' of undefined
     at Pattern.findListItems (/Projects/my-company/code/my-website/node_modules/@pattern-lab/core/src/lib/object_factory.js:277:24)
     at processListItemPartials (/Projects/my-company/code/my-website/node_modules/@pattern-lab/core/src/lib/list_item_hunter.js:8:29)
     at Object.process_list_item_partials (/Projects/my-company/code/my-website/node_modules/@pattern-lab/core/src/lib/list_item_hunter.js:43:14)
     at module.exports (/Projects/my-company/code/my-website/node_modules/@pattern-lab/core/src/lib/decompose.js:26:44)
     at module.exports (/Projects/my-company/code/my-website/node_modules/@pattern-lab/core/src/lib/processMetaPattern.js:18:10)
     at /Projects/my-company/code/my-website/node_modules/@pattern-lab/core/src/lib/buildPatterns.js:96:40
     at async Object.build (/Projects/my-company/code/my-website/node_modules/@pattern-lab/core/src/index.js:134:14)
 Error processing patterns recursively
 where is the engine?
 error during header render()
 where is the engine?
 error during footer render()
 where is the engine?
 error during buildFrontend()
 npm run serve:patternlab exited with code 0
Steps to Reproduce
  1. Create a npm project with workspaces e.g. package.json in root contains:
  {
       "workspaces": [
         "./packages/*"
       ],
   }
  1. Init patterlab in packages/patternlab
  2. Install dependencies by running npm i in the root
  3. Run build or a watch command from root npm run build --workspaces

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