solana-developers / create-solana-dapp

CLI for creating Solana dApps on the fly
https://npmjs.com/package/create-solana-dapp
MIT License
363 stars 108 forks source link

Cannot find module 'rpc-websockets/dist/lib/client' #69

Closed aekiratli closed 6 months ago

aekiratli commented 6 months ago
aek@workstation Git % npx create-solana-dapp@latest

Need to install the following packages:
  create-solana-dapp@3.0.0
Ok to proceed? (y) y
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
(##################) ⠸ reify:nx: http fetch GET 200 https://registry.npmjs.org/nx/-/nx-19.0.0.tgz 10151ms (cache miss)

┌  create-solana-dapp 3.0.0
│
◇  Enter project name
│  test-solana-dapp
│
◇  Select a preset
│  Next.js
│
◇  Select a UI library
│  Tailwind
│
◇  Select an Anchor template
│  Do not include Anchor in the project
│
◇  Successfully created workspace with npm.
│
◓  Installing preset @solana-developers/preset-next@3.0.0.
 NX   Cannot find module 'rpc-websockets/dist/lib/client'

Require stack:
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/@solana/web3.js/lib/index.cjs.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/@solana-developers/preset-anchor/src/generators/anchor-template/anchor-template-generator.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/@solana-developers/preset-anchor/src/generators/anchor-application/anchor-application-generator.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/@solana-developers/preset-anchor/src/index.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/@solana-developers/preset-react/src/utils/setup-anchor-react-feature.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/@solana-developers/preset-react/src/utils/index.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/@solana-developers/preset-react/src/generators/react-application/react-application-generator.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/@solana-developers/preset-react/src/index.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/@solana-developers/preset-next/src/generators/next-application/next-application-generator.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/nx/src/config/schema-utils.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/nx/src/command-line/run/executor-utils.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/nx/src/devkit-internals.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/nx/src/utils/assert-workspace-validity.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/nx/src/project-graph/build-project-graph.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/nx/src/project-graph/project-graph.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/nx/src/project-graph/file-utils.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/nx/src/utils/package-manager.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/nx/src/utils/child-process.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/nx/src/command-line/migrate/command-object.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/nx/src/command-line/nx-commands.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/nx/bin/init-local.js
- /Users/aek/Desktop/Git/test-solana-dapp/node_modules/nx/bin/nx.js
Pass --verbose to see the stacktrace.

 NX   Failed to apply preset: @solana-developers/preset-next

See above

■  Canceled
npm notice 
npm notice New major version of npm available! 9.7.2 -> 10.8.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.1
npm notice Run npm install -g npm@10.8.1 to update!
npm notice 

aek@workstation Git % uname -a
Darwin workstation.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64
uafrontender commented 6 months ago

@aekiratli it's related to last release in rpc-websocket package.

Currently, we can use create-solana-dapp locally, following to https://github.com/solana-developers/create-solana-dapp/blob/main/CONTRIBUTING.md .

I fixed issue with adding 'rpc-websockets': '7.11.0', to packages/preset-common/src/utils/package-versions.ts

Looks like

export const packageVersion = {
  '@coral-xyz': {
    anchor: '^0.30.0',
  },
  '@tailwindcss': {
    typography: '0.5.13',
  },
  'rpc-websockets': '7.11.0',
  '@solana': {
    'spl-token': '0.4.6',
    'wallet-adapter-base': '^0.9.23',
    'wallet-adapter-react': '^0.15.35',
    'wallet-adapter-react-ui': '^0.9.35',
    'web3.js': '1.91.8',
  },

After that I deployed to local yarn registry and run package as described in CONTRIBUTING guide.

beeman commented 6 months ago

Hey @aekiratli and @uafrontender, I reproduced the issue locally and will look at pushing out a fix.

kox commented 6 months ago

Hey, I think rpc-websockets 7.11.0 will get deprecated: https://github.com/elpheria/rpc-websockets/pull/161

The fix for this issue is open: https://github.com/solana-labs/solana-web3.js/pull/2758

yonigoldberg commented 6 months ago

+1 we see this issue as well

beeman commented 6 months ago

+1 we see this issue as well

Probably everyone sees it, I confirmed it here https://github.com/solana-developers/create-solana-dapp/issues/69#issuecomment-2144902641

No need to +1

kox commented 6 months ago

The fix got released to support the new version with the cjs imports: https://github.com/solana-labs/solana-web3.js/releases/tag/v1.91.9

beeman commented 6 months ago
$ pnpx create-solana-dapp@latest rpc-error
┌  create-solana-dapp 3.0.0
│
◆  Project name: rpc-error
│
◇  Select a preset
│  Next.js
│
◇  Select a UI library
│  Tailwind
│
◇  Select an Anchor template
│  Do not include Anchor in the project
│
◇  Successfully created workspace with pnpm.
│
◇  Successfully installed preset @solana-developers/preset-next@3.0.0.
│
◇  Installation successful! ───────────────────────────╮
│                                                      │
│  That's it!                                          │
│                                                      │
│  Change to your new directory and start developing:  │
│                                                      │
│  cd ./rpc-error                                      │
│                                                      │
│  Start the Next.js app:                              │
│                                                      │
│  pnpm run dev                                        │
│                                                      │
├──────────────────────────────────────────────────────╯
│
└  Good luck with your project!

The issue with @sonala/web3.js is now fixed, and the CLI seems to work again.

kox commented 6 months ago

Sorry for commenting after the issue was closed. I noticed that the yarn.lock file still references the problematic version. Shouldn't it be updated? The reference can be found here:

https://github.com/solana-developers/create-solana-dapp/blob/e3d44e22aeed582a92393f87b7c8817f68b278db/yarn.lock#L2036

uafrontender commented 6 months ago

@kox you are right. We can now use package but created next.js app still has old version of @solana/web3.js package in its package.json

@beeman should we create new issue?

beeman commented 6 months ago

@kox you are right. We can now use package but created next.js app still has old version of @solana/web3.js package in its package.json

@beeman should we create new issue?

Either start a new app, or update the version manually. It's not something we'll fix in the CLI.

After manually updating package.json, you can nuke the yarn.lock, package-lock.json, or pnpm-lock.yaml and run the package install again and it should pull in the right version.

beeman commented 6 months ago

To be sure, I pushed v3.0.1 which has the updated package version.

image