nwb icon indicating copy to clipboard operation
nwb copied to clipboard

Strange error with babel preset when using yarn linked repo

Open tnrich opened this issue 5 years ago • 1 comments

Hey there @insin ,

I have a fairly easy to reproduce issue that is confusing me. I'm using nwb in two different repos, openVectorEditor (https://github.com/TeselaGen/openVectorEditor) and ve-sequence-utils (https://github.com/TeselaGen/ve-sequence-utils). ve-sequence-utils are a dev-dep in openVectorEditor.

When I yarn link ve-sequence-utils in openVectorEditor I get the following error:

Couldn't find preset "es2015" relative to directory

I am not sure why babel would be getting run on something within my node modules.

Here are exact steps for reproducing this issue:

git clone https://github.com/TeselaGen/openVectorEditor
git clone https://github.com/TeselaGen/ve-sequence-utils
cd openVectorEditor
yarn 
cd ../ve-sequence-utils
yarn
yarn build
yarn link
cd ../openVectorEditor
yarn link ve-sequence-utils
yarn start

You'll see the babel preset error.

I've googled around for how to solve this error, and none of the solutions that say "delete your babelrc file in your user dir" have worked for me. My coworker was also able to reproduce. The only way I've gotten it to work so far is by adding

"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",

as dev deps to ve-sequence-utils. Which doesn't seem necessary to me as ve-sequence-utils doesn't use them.

Thanks!

tnrich avatar Feb 26 '19 17:02 tnrich

Here's the full error message:

ERROR  in ../ve-sequence-utils/lib/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Couldn't find preset "es2015" relative to directory "/Users/taoh/Sites/ve-sequence-utils/lib"
    at /Users/taoh/Sites/openVectorEditor/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
    at Array.map (<anonymous>)
    at OptionManager.resolvePresets (/Users/taoh/Sites/openVectorEditor/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
    at OptionManager.mergePresets (/Users/taoh/Sites/openVectorEditor/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
    at OptionManager.mergeOptions (/Users/taoh/Sites/openVectorEditor/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
    at OptionManager.init (/Users/taoh/Sites/openVectorEditor/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at File.initOptions (/Users/taoh/Sites/openVectorEditor/node_modules/babel-core/lib/transformation/file/index.js:212:65)
    at new File (/Users/taoh/Sites/openVectorEditor/node_modules/babel-core/lib/transformation/file/index.js:135:24)
    at Pipeline.transform (/Users/taoh/Sites/openVectorEditor/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at transpile (/Users/taoh/Sites/openVectorEditor/node_modules/babel-loader/lib/index.js:50:20)
    at /Users/taoh/Sites/openVectorEditor/node_modules/babel-loader/lib/fs-cache.js:118:18
    at ReadFileContext.callback (/Users/taoh/Sites/openVectorEditor/node_modules/babel-loader/lib/fs-cache.js:31:21)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:235:13)
 @ ./demo/src/StandaloneAlignmentDemo.js 31:23-51
 @ ./demo/src/index.js
 @ multi ./node_modules/nwb/polyfills.js (webpack)-dev-server/client?http://localhost:3344/ (webpack)/hot/only-dev-server.js ./demo/src/index.js

tnrich avatar Feb 26 '19 18:02 tnrich