Closed ichiriac closed 7 years ago
Just was able to reproduce the issue. Turns out I have some global types that ts-node
uses and that ended in the tool not working (I was soo excited :laughing: ) + I was able to identify a slight incompatibility with node:4
(I was using 6 while developing) the fix takes a few steps actually:
devDependencies
to ask for ~4.0
of `@types/node"typeRoots
in tsconfig.json
to node_modules/@types/
import * as process from 'process'
in the bin/php-inspections.ts
I will commit the fix in a few mins
As far as I can tell 0a71ec9
resolves the issue, mind verifying for me :)
Iit's better, the list of error is smaller :
/usr/local/lib/node_modules/ts-node/src/index.ts:312
throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
^
TSError: ⨯ Unable to compile TypeScript
bin/php-inspections.ts (3,21): Cannot find module 'fs'. (2307)
bin/php-inspections.ts (4,26): Cannot find module 'process'. (2307)
at getOutput (/usr/local/lib/node_modules/ts-node/src/index.ts:312:17)
at /usr/local/lib/node_modules/ts-node/src/index.ts:343:18
at Object.compile (/usr/local/lib/node_modules/ts-node/src/index.ts:502:17)
at Module.m._compile (/usr/local/lib/node_modules/ts-node/src/index.ts:406:44)
at Module._extensions..js (module.js:417:10)
at Object.require.extensions.(anonymous function) [as .ts] (/usr/local/lib/node_modules/ts-node/src/index.ts:409:12)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at Object.<anonymous> (/usr/local/lib/node_modules/ts-node/src/_bin.ts:184:12)
maybe it's the same reason : https://github.com/Microsoft/TypeScript/issues/5812
found the solution here : http://stackoverflow.com/questions/37260901/how-to-find-module-fs-in-ms-code-with-typescript
npm install typings --global
typings install dt~node --global --save
And after everything runs well :smile:
Lol I was just getting desperate... I was going to set up docker just to reproduce :smile: Anyway, Ill add it to the README
But still it should see the typings inside the node_modules
directory, unless I am missing something with ts-node
oups, i've made a npm install
after getting the unable to find php-parser error :(
Hi @DaGhostman,
When I run it from the command line, I got this error :
I'm running it from ubuntu 16, ts-node v1.7.2 and node v4.2.6.
Any clue ?