You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docs state that it's possible to import npm packages by simply natively importing them. However, I get the following errors:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'zod' imported from C:\Users\David.kenv\kenvs\script-kit-private\scripts\test.ts
Error: EPERM: operation not permitted, symlink 'C:\Users\David\AppData\Local\Temp\kit\test' -> 'C:\Users\David.kenv\tmp\test'
by simply running the following script:
// Name: test
import kit from "@johnlindquist/kit";
import zod from "zod";
const result = zod.string("").safeParse();
kit.div(JSON.stringify(result));
Is it a permission issue? Couldn't find missing permissions for my user though. I'm running on Windows 11.
Another issue was that vscode was unable to pick up the types of the package link:
"@johnlindquist/kit": "link:C:/Users/David/.kit",
When I was going to the references (via ctrl+click), I was navigated to the index.js file rather than the type definitions. Solved it by adding a tsconfig.json as a workaround to the root of the .kenv dir:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@johnlindquist/kit": [
"C:/Users/David/.kit/types/index.d.ts" // Path to the type declaration file
]
}
}
}
Expected it to work out of the box though, am I doing sth. wrong? It's a fresh installation on Windows 11
When I hover over the package import @johnlindquist/kit I get: There are types at c:/Users/David/.kenv/node_modules/@johnlindquist/kit/types/index.d.ts , but this result could not be resolved when respecting package.json "exports". The @johnlindquist/kit library may need to update its package.json or typings.
I Also didn't get the npm package part. Do I need to install them globally?
Ok my bad, somehow the package.json and tsconfig.json was missing for my kenv. Now it works.
I'm assuming you are supposed to install the packages for each kenv as they have their own package.json?
If the dependencies aren't installed in those, then node looks up the parent directories for package.json/node_modules and will find ~/.kenv/package.json/~/.kenv/node_modules. So you only need to install them if you want custom versions of the packages for the scripts in those kenvs. Does that make sense?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Docs state that it's possible to import npm packages by simply natively importing them. However, I get the following errors:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'zod' imported from C:\Users\David.kenv\kenvs\script-kit-private\scripts\test.ts
Error: EPERM: operation not permitted, symlink 'C:\Users\David\AppData\Local\Temp\kit\test' -> 'C:\Users\David.kenv\tmp\test'
by simply running the following script:
Is it a permission issue? Couldn't find missing permissions for my user though. I'm running on Windows 11.
Another issue was that vscode was unable to pick up the types of the package link:
When I was going to the references (via ctrl+click), I was navigated to the
index.jsfile rather than the type definitions. Solved it by adding atsconfig.jsonas a workaround to the root of the.kenvdir:Expected it to work out of the box though, am I doing sth. wrong? It's a fresh installation on Windows 11
All reactions