yarn icon indicating copy to clipboard operation
yarn copied to clipboard

bug: yarn link not working for monorepo setup

Open IlCallo opened this issue 7 years ago • 3 comments

Do you want to request a feature or report a bug? bug

What is the current behavior? yarn link doesn't seem to work for monorepo setup, in this case expecially Angular Material monorepo. See https://github.com/angular/material2/issues/14270

What is the expected behavior? The symlink should work

Please mention your node.js, yarn and operating system version. Node 10.13.0 yarn 1.12.3 OS: windows 10

IlCallo avatar Dec 07 '18 07:12 IlCallo

We're running into a similar issue with preact@next. Our structure is like this:

/subpackage1
  /package.json
  /dist/...
/subpackage2
  /package.json
  /dist/...
/dist
package.json

Only the top-level module can be required when linking via yarn link. Neither of the sub-packages will work. This is the code that triggers the error:

const { Component } = require("preact");
const { useState } = require("preact/hooks"); // imports "preact"
console.log(Component, useState);

And the error itself:

internal/modules/cjs/loader.js:605
    throw err;
    ^

Error: Cannot find module 'preact'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Module.require (internal/modules/cjs/loader.js:657:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/marvinh/dev/github/preact/hooks/dist/hooks.js:1:73)
    at Module._compile (internal/modules/cjs/loader.js:721:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)

marvinhagemeister avatar Mar 08 '19 22:03 marvinhagemeister

Will there be an update for this?

oschade avatar Mar 16 '19 14:03 oschade

Have the same problem....

rsoika avatar Feb 10 '24 13:02 rsoika