Closed ghost closed 4 years ago
The error above looks to be failing because it cannot find your typescript
module. Do you have typescript
installed in the project you are running this on? ts-standard
does not install typescript
for you, but rather declares it as a peerDependency
(meaning you have to install it manually yourself).
This is my package.json
. So I guess, it should work.
https://github.com/Syy0n/serverless-blueprint/blob/master/package.json
Adding it as devDependency solved the problem. But via npx
it is not working.
I kind of figured that would be the case (you already have it installed), but I like to start simple and work towards complex 😉
So I just pulled down that repo, and cd
into the root directory (where package.json
was). I then performed the following steps:
//1
, //2
, etc... stuff in the package.json
npm install
npm run build
npx ts-standard --fix
Everything worked great and ts-standard
ran as expected. I also used a fresh node installation so that there were no globally install modules.
Try deleting your node_modules
folder and redoing a full npm install
all over again...sometimes things get screwed up in there.
It also might be the //1
, //2
etc in your package.json
as a lot of tools will read that file and if it does not contain valid JSON
it might screw with how the tool operates.
If you are still running into issues, try recreating a minimal repo example with a single typescript file and a package.json
with typescript
and ts-standard
and see if it continues to happen there.
Adding it as devDependency solved the problem. But via npx it is not working.
☝️ That was super helpful. I forget that people run npx ...
without actually installing the module they are running npx
on. I just hit the same error. It is very interesting...will look into it, but I am guessing this is actually an issue with how @typescript-eslint/parser
actually finds and uses the typescript
package
After some additional research, it seems to be an issue with npx
itself and how it resolves node_modules
. From what I can tell, npx
does not install the module globally or locally, but instead, in some weird cache location that does not have access (or maybe a bug) to either global or local node_modules
.
For now, the only solution is to make sure ts-standard
is installed locally before running npx ts-standard
.
Interestingly enough, this issue might be solved by npm@7
because it will install peerDependencies
by default thus, wherever npx
installs ts-standard
it should also install typescript
too.
Closing this as it is not fixable by this project.
Hey guys,
when running
npx ts-standard --fix
in my ts-project, I am getting: