Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

../lib not found #633

Open
brooke007 opened this issue Jul 2, 2024 · 1 comment
Open

../lib not found #633

brooke007 opened this issue Jul 2, 2024 · 1 comment

Comments

@brooke007
Copy link

I already check the issue has been solved, https://github.com/ckb-js/ckb-sdk-js/issues/208. My issue has some different. packages/ckb-sdk-core/examples/nervosDAO.js, the file dosen't exit ../lib and I already tried to run

$ yarn install # to install the lerna package in this project, could be skipped if the lerna has been installed globally
$ lerna bootstrap # install the depedencies and link the packages in the project
$ npm run tsc # build packages with tsc command

but got nothing, the ../lib hasn't show, and if you use default lerna version , if will gives me The bootstrap command was removed by default in v7 and is no longer maintained error, and I already downgraded the package to 6.6.2.

@Keith-CY
Copy link
Member

Hi @brooke007
The command lerna bootstrap has been natively supported by yarn and npm, so running the following commands will generate the lib

$ yarn install
$ yarn run tsc

I've tried it.

But there is a new issue introduced by an update(#637) weeks ago that ckb-sdk-js is now es module(https://nodejs.org/api/esm.html#modules-ecmascript-modules) by default while all examples are based on commonjs module(https://nodejs.org/api/modules.html#modules-commonjs-modules)

When the workspace conforms to es module, modules should be imported by import instead of require(https://github.com/ckb-js/ckb-sdk-js/blob/develop/packages/ckb-sdk-core/examples/nervosDAO.js#L2-L5)

import path from 'path'
import os from 'os'
import CKB from '../lib-esm/index.js'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants