Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

"An import path cannot end with a '.ts' extension." #17

Open
sneurlax opened this issue Apr 25, 2018 · 5 comments
Open

"An import path cannot end with a '.ts' extension." #17

sneurlax opened this issue Apr 25, 2018 · 5 comments

Comments

@sneurlax
Copy link

When I try import * as blockstack from blockstack.ts'` I get the error:

An import path cannot end with a '.ts' extension. Consider importing '/node_modules/blockstack' instead.
@vsund
Copy link
Member

vsund commented Apr 25, 2018

Yup, that's because I uploaded an empty package to NPM. Technically there's nothing to import, which gets the compiler to think that the package was misspelled.

If you'd like to try this out though, you can use yarn link ;)

@sneurlax
Copy link
Author

sneurlax commented Apr 25, 2018

I used npm i --save https://github.com/ntzwrk/blockstack.ts.git, so I should have the latest version from git.

@sneurlax
Copy link
Author

This import * as blockstack from 'blockstack'; results in this, which may not be an issue on your end at all (I think it's from Stencil, which is still in alpha.)

[27:46.0]  changed file: ionic-pwa-toolkit.tsx
[27:46.0]  rebuild, app, dev mode, started ...
[27:46.0]  compile started ...

[ ERROR ]  tsHost.getSourceFile unable to find: /home/user/github/ionic-pwa-toolkit/node_modules/blockstack.ts EISDIR:
           illegal operation on a directory, read Error: EISDIR: illegal operation on a directory, read at
           Object.fs.readSync (fs.js:690:18) at tryReadSync (fs.js:554:20) at Object.fs.readFileSync (fs.js:597:19) at
           NodeFs.readFileSync (/home/user/github/ionic-pwa-toolkit/node_modules/@stencil/core/dist/sys/node/index.js:682:19)
           at InMemoryFileSystem.readFileSync
           (/home/user/github/ionic-pwa-toolkit/node_modules/@stencil/core/dist/compiler/index.js:1851:39) at
           Object.tsHost.getSourceFile
           (/home/user/github/ionic-pwa-toolkit/node_modules/@stencil/core/dist/compiler/index.js:7099:34) at findSourceFile
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:76883:29) at processImportedModules
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:77055:25) at findSourceFile
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:76931:17) at args
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:76819:85)


[ ERROR ]  tsHost.getSourceFile unable to find: /home/user/github/ionic-pwa-toolkit/node_modules/blockstack.ts EISDIR:
           illegal operation on a directory, read Error: EISDIR: illegal operation on a directory, read at
           Object.fs.readSync (fs.js:690:18) at tryReadSync (fs.js:554:20) at Object.fs.readFileSync (fs.js:597:19) at
           NodeFs.readFileSync (/home/user/github/ionic-pwa-toolkit/node_modules/@stencil/core/dist/sys/node/index.js:682:19)
           at InMemoryFileSystem.readFileSync
           (/home/user/github/ionic-pwa-toolkit/node_modules/@stencil/core/dist/compiler/index.js:1851:39) at
           Object.tsHost.getSourceFile
           (/home/user/github/ionic-pwa-toolkit/node_modules/@stencil/core/dist/compiler/index.js:7099:34) at findSourceFile
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:76883:29) at processImportedModules
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:77055:25) at findSourceFile
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:76931:17) at args
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:76819:85)

[27:49.6]  compile finished in 3.58 s

[ ERROR ]  typescript: src/components/ionic-pwa-toolkit/ionic-pwa-toolkit.tsx, line: 4
           Cannot find module 'blockstack'.

      L4:  import * as blockstack from 'blockstack';

@sneurlax
Copy link
Author

And I mean, there is definitely this repo in my node_modules/blockstack.ts/, I just don't know how to use it. Maybe too early of a state and I should find a workaround with blockstack.js?

@vsund
Copy link
Member

vsund commented Apr 26, 2018

import * as blockstack from 'blockstack'; references the original library and not this fork.

I guess you removed the .ts at the end because of the initial error? The NPM version for blockstack.ts currently has no code (that's why the compiler complaints). For me locally everything works with yarn link.

I guess the npm i --save https://github.com/ntzwrk/blockstack.ts.git did not what it should. Can you check whether there's code in ./node_modules/blockstack.ts/dist/? Maybe it didn't trigger the build process (which then would be a different error for later).

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

2 participants