Closed mak1A4 closed 2 years ago
Remove line: import 'zx/globals'
this is esm limitation.
So there currently is no way to get autocompletion in vscode if zx
is installed globally and not locally?
If so, maybe update the Readme because there it's stated that this is how you should get autocompletion.
It’s possible use reference.
Thanks this // <reference 'zx/globals' />
worked : )
Thanks this
// <reference 'zx/globals' />
worked : )
Hi, how did u use reference
directive 😂? @mak1A4
I use like below but it said "Cannot find type definition file for 'zx/globals'.". Did u also install zx
as a global module?
/// <reference types="zx/globals" />
I have the issue too. The readme should be fixed to say that its not possible. I also added // <reference 'zx/globals' />
but nothing happened.
@bluebrown
I installed zx
in node module path($HOME
in my case), then import { $ } from 'zx'
, and then the ts intellisense is working. You could have a try~
@kongmoumou thanks, cd ~ && npm i zx
and now it works
Expected Behavior
Autocomplete for globals in vscode show up
Actual Behavior
I get an "ERR_MODULE_NOT_FOUND" error when executing a script which cointains
import zx/globals
Steps to Reproduce the Problem
For me this results in the following error:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'zx' imported from /Users/myUser/Scripts/calc.mjs at new NodeError (node:internal/errors:372:5) at packageResolve (node:internal/modules/esm/resolve:908:9) at moduleResolve (node:internal/modules/esm/resolve:957:20) at defaultResolve (node:internal/modules/esm/resolve:1173:11) at ESMLoader.resolve (node:internal/modules/esm/loader:604:30) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:318:18) at ModuleWrap. (node:internal/modules/esm/module_job:80:40)
at link (node:internal/modules/esm/module_job:78:36) {
code: 'ERR_MODULE_NOT_FOUND'
}