chainbridge-ui icon indicating copy to clipboard operation
chainbridge-ui copied to clipboard

Module not found: Can't resolve '@chainsafe/chainbridge-ui-core' in 'D:\chainbridge-ui\packages\example\src'

Open Uponn opened this issue 2 years ago • 2 comments

While trying to run the UI I encounter the following error:

D:\chainbridge-ui>yarn start:ui
yarn run v1.22.18
$ yarn wsrun -p @chainsafe/chainbridge-ui -c start
$ D:\chainbridge-ui\node_modules\.bin\wsrun -p @chainsafe/chainbridge-ui -c start
@chainsafe/chainbridge-ui
$ yarn setup:copy-dev-config && craco --max_old_space_size=4096 start
$ ./scripts/copy-dev-config.sh
 | i 「wds」: Project is running at https://192.168.1.3/
 | i 「wds」: webpack output is served from 
 | i 「wds」: Content not from webpack is served from D:\chainbridge-ui\packages\example\public
 | i 「wds」: 404s will fallback to /
 | Starting the development server...
 |
 | Failed to compile.
 | 
 | ./src/App.tsx
 | Module not found: Can't resolve '@chainsafe/chainbridge-ui-core' in 'D:\chainbridge-ui\packages\example\src'
 | Error from chokidar (D:\): Error: EBUSY: resource busy or locked, lstat 'D:\DumpStack.log.tmp'

I've tried using yarn start:ui yarn start:basic. Tried moving into packages/example and running yarn install there and yarn start, same error occures. I mainly see the error in App.tsx on those imports

import {
  ChainbridgeProvider,
  NetworkManagerProvider,
  LocalProvider,
} from "@chainsafe/chainbridge-ui-core";

Steps to Reproduce (for bugs)

  1. Clean clone of repo
  2. run yarn install
  3. run yarn start:ui, yarn start:basic

Versions

I've tried different versions of node, lowest that passes yarn install succesfully is 14.17.0, 16.15.0 and 16.17.1 Tried on Windows 10 and OSX.

Uponn avatar Nov 29 '22 09:11 Uponn

The issue here has to do with the way yarn workspaces work. Since the version of chainbridge-ui-core is the same as the one present in the npm registry, on install, yarn is not going to fetch dependency from registry but rather is going to create a symbolic link in the node_modules folder with the dependency. This symbolic link doesn't have the dist folder, hence, on the examples is not possible to import the modules or types associated with it.

The solution to this is to move examples folder outside the scope of packages, so when installing the dependencies of one of the examples, they are going to be fetched from npm registry.

wainola avatar Nov 30 '22 16:11 wainola

run yarn build:core to build core module

hangleang avatar May 31 '23 08:05 hangleang