-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
[Bug]: Missing dependencies causing TypeScript build failure in dependents #1140
Comments
Update; after installing suggested dependencies I got rid of remaining errors by adding Example patch {
"compilerOptions": {
"outFile": "./assets/js/main.js",
"target": "es2019",
"module": "AMD",
"lib": ["DOM", "DOM.Iterable", "es2019"],
"moduleResolution": "node",
"sourceMap": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"noImplicitAny": true,
"removeComments": true,
- "experimentalDecorators": false
+ "experimentalDecorators": false,
+ "skipLibCheck": true
},
"include": ["src/assets/js/**/*.ts", "./@types"],
"exclude": ["node_modules"]
} ... This likely means this Issue can be resolved once the |
Hi @S0AndS0 ! |
Howdy @christopherferreira9! Sure thing, I just tested on a fully new project and still no joy. Here be the whole set of steps so feel free to call me out if I'm making mistakes. Setup project## Git gud
git init /tmp/mm-test
cd "${_}"
## Initialize NPM project and install dependencies
npm init --yes
npm install --save-dev typescript &&
npm install @metamask/sdk
## Write a TypeScript configuration
tee tsconfig.json 1>/dev/null <<'EOF'
{
"compilerOptions": {
"outFile": "./assets/js/main.js",
"target": "es2019",
"module": "AMD",
"lib": ["DOM", "DOM.Iterable", "es2019"],
"moduleResolution": "node",
"sourceMap": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"noImplicitAny": true,
"removeComments": true,
"experimentalDecorators": false
},
"include": ["src/assets/js/**/*.ts", "./@types"],
"exclude": ["node_modules"]
}
EOF
## Create and populate source code directory/file
mkdir -p src/assets/js
tee "${_}/main.ts" 1>/dev/null <<'EOF'
"use strict";
import type MetaMaskSDK from '@metamask/sdk';
EOF Attempt to buildnpx tsc Error (snip)
Additional detailsExtract precise version(s) of MetaMask, and Ethereum JS, libraries that were installed; jq '.packages
| with_entries(
if (.key|test("(metamask|ethereumjs)"))
then ({ key: .key, value: .value.version })
else empty end
)' package-lock.json ... results as of 2025-01-07 13:16 -0800; {
"node_modules/@ethereumjs/common": "3.2.0",
"node_modules/@ethereumjs/rlp": "4.0.1",
"node_modules/@ethereumjs/tx": "4.2.0",
"node_modules/@ethereumjs/util": "8.1.0",
"node_modules/@metamask/json-rpc-engine": "8.0.2",
"node_modules/@metamask/json-rpc-middleware-stream": "7.0.2",
"node_modules/@metamask/object-multiplex": "2.1.0",
"node_modules/@metamask/onboarding": "1.0.1",
"node_modules/@metamask/providers": "16.1.0",
"node_modules/@metamask/rpc-errors": "6.4.0",
"node_modules/@metamask/rpc-errors/node_modules/@metamask/utils": "9.3.0",
"node_modules/@metamask/rpc-errors/node_modules/uuid": "9.0.1",
"node_modules/@metamask/safe-event-emitter": "3.1.2",
"node_modules/@metamask/sdk": "0.31.4",
"node_modules/@metamask/sdk-communication-layer": "0.31.0",
"node_modules/@metamask/sdk-install-modal-web": "0.31.2",
"node_modules/@metamask/superstruct": "3.1.0",
"node_modules/@metamask/utils": "8.5.0",
"node_modules/@metamask/utils/node_modules/uuid": "9.0.1"
} |
SDK
Web
Provide environment information
OS: Linux
IDE: Vim
Stage: TypeScript build fails for listed reasons
Howdy team! What follows are the configurations, commands, and resulting errors caused by attempting to install and use the MetaMask SDK in a new project. TLDR It seems as though
@types/readable-stream
,@types/react
, and some unknown packages are missing from y'alls'package.json
file. And any help on sorting out what the "unknown packages" be would be much appreciated.MetaMask SDK Version
0.30.3
MetaMask Mobile app Version
N/A
What browser are you using? (if relevant)
N/A
How are you deploying your application? (if relevant)
N/A
Describe the Bug
Error from
npm run ts-build
Installing suggested packages
Updated
package.json
Errors, though less, persist with
npm run ts-build
Expected Behavior
Expect
npm run ts-build
to build (transpile) TypeScript into JavaScriptLink to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster
No response
To Reproduce
Initial
package.json
Write a TypeScript file that imports types from MetaMask
Run
npm run ts-build
as prescribedThe text was updated successfully, but these errors were encountered: