question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doesn't work with yarn workspaces

See original GitHub issue

It works great but I need to use this boilerplate in monorepo project and I faced following error :

[4/4] Building fresh packages...
[-/5] ⠁ waiting...
[-/5] ⠁ waiting...
[5/5] ⠁ electron-react-boilerplate
[-/5] ⠂ waiting...
error D:\V.lab\workspace\Web\workspace\node_modules\electron-react-boilerplate: Command failed.
Exit code: 1
Command: node -r babel-register internals/scripts/CheckNativeDep.js && npm run flow-typed && npm run build-dll && electron-builder install-app-deps && node node_modules/fbjs-scripts/node/check-dev-engines.js package.json
Arguments:
Directory: D:\V.lab\workspace\Web\workspace\node_modules\electron-react-boilerplate
Output:
D:\V.lab\workspace\Web\workspace\node_modules\babel-core\lib\transformation\file\options\option-manager.js:328
        throw e;
        ^

Error: Options {"loose":true} passed to D:\V.lab\workspace\Web\workspace\node_modules\babel-preset-env\lib\index.js which does not accept options. (While processing preset: "D:\\V.lab\\workspace\\Web\\workspace\\node_modules\\babel-preset-env\\lib\\index.js") (While processing preset: "D:\\V.lab\\workspace\\Web\\workspace\\node_modules\\babel-preset-env\\lib\\index.js")
    at D:\V.lab\workspace\Web\workspace\node_modules\babel-core\lib\transformation\file\options\option-manager.js:314:17    at Array.map (<anonymous>)
    at OptionManager.resolvePresets (D:\V.lab\workspace\Web\workspace\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20)
    at OptionManager.mergePresets (D:\V.lab\workspace\Web\workspace\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10)
    at OptionManager.mergeOptions (D:\V.lab\workspace\Web\workspace\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14)
    at OptionManager.init (D:\V.lab\workspace\Web\workspace\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
    at compile (D:\V.lab\workspace\Web\workspace\node_modules\babel-register\lib\node.js:103:45)
    at loader (D:\V.lab\workspace\Web\workspace\node_modules\babel-register\lib\node.js:144:14)

It’s easy to reproduce so I didn’t make repro-repo but if it’s needed then I can. Steps to reproduce:

  1. Create tree:
workspace 
  ├───packages
  │   └─────electron-react-boilerplate
  └───package.json
  1. Write to workspace\package.json :
{
  "private": true,
  "workspaces": {
    "packages": [
      "packages/*"
    ]
  }
}
  1. run yarn inside workspace

My enviornment: Windows 10 (1803, build 17134,165) (x64) Node: 10.6.0 npm: 6.2.0 yarn: 1.7.0

P.S. I’ve tested this case under Ubuntu 18.04 with: Node: 10.7.0 npm: 6.1.0 yarn: 1.7.0 and MacOS High Sierra with: Node: 10.3.0 npm: 6.1.0 yarn: 1.5.1 and in both OS I faced other but similar error:


!! No flow@v0.72.0-compatible libdefs found in flow-typed for the above untyped dependencies !!

I've generated `any`-typed stubs for these packages, but consider submitting 
libdefs for them to https://github.com/flowtype/flow-typed/


> electron-react-boilerplate@0.13.3 build-dll /home/server/workspace/packages/electron-react-boilerplate
> cross-env NODE_ENV=development node --trace-warnings -r babel-register ./node_modules/webpack/bin/webpack --config webpack.config.renderer.dev.dll.js --colors

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

Error: Cannot find module '/home/server/workspace/packages/electron-react-boilerplate/node_modules/webpack/bin/webpack'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:266:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron-react-boilerplate@0.13.3 build-dll: `cross-env NODE_ENV=development node --trace-warnings -r babel-register ./node_modules/webpack/bin/webpack --config webpack.config.renderer.dev.dll.js --colors`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the electron-react-boilerplate@0.13.3 build-dll script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Hope it helps

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
vikr01commented, Aug 6, 2018

I think the issue might have been that the globs pattern didn’t match all node_modules of erb. I was noticing some babel plugins being in the root folder instead of the erb folder, but after modifying everything was in erb only.

{
  "workspaces": {
    "nohoist": ["**/*"]
  }
}

This should work.

Though, I moved it to the root instead so that you don’t have to manage it inside erb.

1reaction
vikr01commented, Jul 29, 2018

The problem is that certain scripts in package.json use scripts that depend on the node_modules folder being in the root.

For example in postinstall,

node node_modules/fbjs-scripts/node/check-dev-engines.js package.json

The workaround to this is to include this in your cloned electron-react-boilerplate’s package.json.

{
  "private": true,
  "workspaces": {
    "nohoist": ["webpack", "webpack-dev-server", "eslint-formatter-pretty", "fbjs-scripts"]
  }
}

See an example here. See more about nohoist here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Workspaces - Yarn
Workspaces are a new way to set up your package architecture that's available by default starting from Yarn 1.0. It allows you to...
Read more >
[Bug] Workspaces not linking · Issue #839 · yarnpkg/berry
For my scenario, yarn workspaces list from the monorepo root would list foo but the same command from inside foo lists nothing. Deleting...
Read more >
Yarn 2 workspaces not installing dependencies - Stack Overflow
I'm testing out setting up yarn 2 workspaces. I think I've done it the way I'm supposed to, but when I run yarn...
Read more >
Migrating our Monorepo to Yarn 2 | DoltHub Blog
I initially decided to upgrade our repository when I came across one of Yarn 2's new commands researching a solution to a dependency...
Read more >
No yarn workspaces detected despite using workspaces for ...
what am I doing wrong? and how can I speed up the build process? is using one netlify project that deploys to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found