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

Some imported modules are missing type declarations #173

Closed
bodqhrohro opened this issue Oct 17, 2020 · 3 comments · Fixed by #192
Closed

Some imported modules are missing type declarations #173

bodqhrohro opened this issue Oct 17, 2020 · 3 comments · Fixed by #192
Labels
question Further information is requested

Comments

@bodqhrohro
Copy link
Contributor

Describe the bug

> matrix-bifrost@0.1.8 build /media/d/temp/git/matrix-bifrost
> tsc

src/xmppjs/XJSConnection.ts:1:25 - error TS2307: Cannot find module '@xmpp/component-core' or its corresponding type declarations.

1 import {Component} from "@xmpp/component-core";
                          ~~~~~~~~~~~~~~~~~~~~~~

src/xmppjs/XJSConnection.ts:2:23 - error TS2307: Cannot find module '@xmpp/reconnect' or its corresponding type declarations.

2 import Reconnect from "@xmpp/reconnect";
                        ~~~~~~~~~~~~~~~~~


Found 2 errors.

 ERROR  Command failed with exit code 2.

To Reproduce

npm i
npm run build

Expected behavior
Packages with all required type declarations are provided in package.json.

Desktop (please complete the following information):

  • OS: Debian 11
  • npm: 6.14.8
@Half-Shot
Copy link
Collaborator

Hey, I tried this out on my laptop and I see:

➜  /tmp git clone git@github.com:matrix-org/matrix-bifrost.git          
Cloning into 'matrix-bifrost'...
remote: Enumerating objects: 323, done.
remote: Counting objects: 100% (323/323), done.
remote: Compressing objects: 100% (190/190), done.
remote: Total 3920 (delta 201), reused 215 (delta 128), pack-reused 3597
Receiving objects: 100% (3920/3920), 1012.83 KiB | 969.00 KiB/s, done.
Resolving deltas: 100% (2861/2861), done.
➜  /tmp cd matrix-bifrost 
➜  matrix-bifrost git:(develop) nvm use 12
Now using node v12.18.3 (npm v6.14.6)
➜  matrix-bifrost git:(develop) npm i      
npm WARN deprecated tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported

> fast-xml-parser@3.17.4 postinstall /tmp/matrix-bifrost/node_modules/fast-xml-parser
> node tasks/postinstall.js || exit 0

Love fast-xml-parser? Check https://amitkumargupta.work for more projects and contribution.


> matrix-bifrost@0.1.8 prepare /tmp/matrix-bifrost
> npm run build


> matrix-bifrost@0.1.8 build /tmp/matrix-bifrost
> tsc

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 608 packages from 440 contributors and audited 616 packages in 14.43s

40 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

➜  matrix-bifrost git:(develop) ✗ 

I'm afraid it might be something wrong with your environment. You can try building the docker image which should confirm if it's environmental.

@Half-Shot Half-Shot added the question Further information is requested label Oct 22, 2020
@bodqhrohro
Copy link
Contributor Author

True; I probably did something wrong when trying to check if it is reproduced with npm first time. It actually compiles well with both yarn (which is used in Dockerfile) and npm.

This is actually a pnpm issue. The packages above are not explicitly listed in package.json, but rather are the dependencies of @xmpp/component. pnpm seems to resolve the dependencies, but fails to install them properly, even in the recursive mode. So I'll readdress the issue to pnpm developers, sorry for disturbance.

@zkochan
Copy link

zkochan commented Oct 28, 2020

Any package that is used by the project directly, should be installed as a direct dependency. This is not a pnpm issue. This works with npm and Yarn 1 only because they create a flat node_modules. This will not work with Yarn v2 and pnpm because they create a strict node_modules, which allows access only to the dependencies that are listed in package.json.

There is a workaround to use pnpm install --shamefully-hoist but that is just a workaround, the correct solution is to add the missing dependencies.

bodqhrohro added a commit to bodqhrohro/matrix-bifrost that referenced this issue Oct 31, 2020
bodqhrohro added a commit to bodqhrohro/matrix-bifrost that referenced this issue Oct 31, 2020
Fixes matrix-org#173

Signed-off-by: Bohdan Horbeshko <bodqhrohro@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants