Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

TS cannot find module #8

Closed
pierre-H opened this issue Jan 1, 2017 · 4 comments
Closed

TS cannot find module #8

pierre-H opened this issue Jan 1, 2017 · 4 comments

Comments

@pierre-H
Copy link

pierre-H commented Jan 1, 2017

Can you reproduce the problem with latest npm?

Yes

Description

When I try to import another library, I've got the error "TS : cannot find module libraryName

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected):
C:\Users\Eytan\Documents\tickets>npm ls react-scripts
[email protected] C:\Users\Eytan\Documents\tickets
`-- (empty)

npm ERR! code 1
  1. node -v: v7.3.0
  2. npm -v: 3.10.10

Then, specify:

  1. Operating system: Windows
  2. Browser and version: Vivaldi 1.6.689.40 32bits

Reproducible Demo

yarn global add create-react-app
create-react-app my-app --scripts-version=react-scripts-ts
yarn add admin-on-rest

Then if I add this line on my code :
import { simpleRestClient, Admin, Resource } from 'admin-on-rest';

I've got the error

@pierre-H
Copy link
Author

pierre-H commented Jan 2, 2017

Sorry, this issue is about TS not react-scripts-ts.

@pierre-H pierre-H closed this as completed Jan 2, 2017
@wmonk
Copy link
Owner

wmonk commented Jan 2, 2017

Hi Pierre, no problem! Did you manage to sort it yourself by adding typings?

This might raise an interesting addition we could make like the eslint/taking warnings that suggests adding the typings for new packages. Could be useful if there are TS beginners using this.

@CraigglesO
Copy link

CraigglesO commented Mar 29, 2017

I am using Yarn:

I had an error that said
cannot find name ' require'

But it still ran great (to be clear, this error ran inside atom with the atom-typescript plugin)

But this fixed it (tsconfig.json):

  "compilerOptions": {
      ...
      "types": [
        "node"
      ],
      "typeRoots": [
        "node_modules/@types"
      ]
  }

I am also having an issue with cannot find name "it", (app.test.tsx) But I am sure I will find eventually and get back with you.

@HawiCaesar
Copy link

I had the same problem as @CraigglesO but I managed to get around it. The only issue have is my IDE keeps telling me that cannot find name "it" even though the setup and code runs on the browser.

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

No branches or pull requests

4 participants