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

TS2354 error: module 'tslib' cannot be found -- use moduleResolution: "node" #29

Closed
ywzhaiqi opened this issue Aug 22, 2017 · 5 comments
Assignees
Labels
kind: support Asking for support with something or a specific use case scope: dependencies Issues or PRs about updating a dependency solution: duplicate This issue or pull request already exists

Comments

@ywzhaiqi
Copy link

ywzhaiqi commented Aug 22, 2017

tsconfig.json

{
  "compilerOptions": {
      "outDir": "dist",
      "module": "es2015",
      "target": "es2015"
  },
  "include": [
      "src"
  ]
}

src/test.ts

export default async function hello() {
  console.log('Hello world')
}

run rollup -c Error:

Error: rpt2: rollup-example/src/test.ts (3,23): semantic error TS2354 This syntax requires an imported helper but module 'tslib' cannot be found.

but change to rollup-plugin-typescript, run successful.

@ezolenko
Copy link
Owner

Could you post output of npm install and of npm list tslib?

What's your package.json look like?

@ezolenko ezolenko self-assigned this Aug 22, 2017
@ywzhaiqi
Copy link
Author

ywzhaiqi commented Aug 22, 2017

after remove node_modules and npm install, run the same error.

npm list tslib

package.json

   "devDependencies": {
    "@types/rollup": "^0.41.1",
    "rollup": "^0.48.2",
    "rollup-plugin-json": "^2.3.0",
    "rollup-plugin-typescript2": "^0.5.0"
  },
  "dependencies": {}

@ezolenko
Copy link
Owner

Ah, I think you need "moduleResolution": "node", in your tsconfig.json.

@ywzhaiqi
Copy link
Author

yes, it worked. thanks

@agilgur5 agilgur5 changed the title error TS2354: module 'tslib' cannot be found TS2354 error: module 'tslib' cannot be found -- use moduleResolution: "node" May 26, 2022
@agilgur5 agilgur5 added solution: duplicate This issue or pull request already exists kind: support Asking for support with something or a specific use case labels May 26, 2022
@agilgur5
Copy link
Collaborator

Duplicate of #12 / #14

@agilgur5 agilgur5 added the scope: dependencies Issues or PRs about updating a dependency label May 26, 2022
Repository owner locked as resolved and limited conversation to collaborators May 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: support Asking for support with something or a specific use case scope: dependencies Issues or PRs about updating a dependency solution: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants