I've created vscode extension based on typescript with the following config
the path for the test is
vscode_extensions/my-ext/src/test/runTest.ts:1
**The error is:**
import * as path from "path";
^
SyntaxError: Unexpected token *
the tsconfig is
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "out",
"lib": ["es6"],
"sourceMap": true,
"rootDir": "src"
// "esModuleInterop": true
// "strict": true /* enable all strict type-checking options */
},
"exclude": ["node_modules", ".vscode-test"]
}
Any idea?
The strange thing is that I was able to run the extension and debug it but not able to execute some basic mocha unit test.
I tried to switch to a newer node version using nvm (node 13 ) without success
As this is new for me, mocha test in js maybe I miss something...
When I face problems like that in nodejs - obviously its NOT a syntax issue, because syntax is correct, but somehow environment can't understand its properly - I try to check if its not the problem of node modules
npm cache clean --force
"strict": true
- its always good idea - maybe it will point you other problem which can be connectedOf course check if you have properly installed Tpyescript, nodejs and so on - the easiest way it to check if Helo_World programs from documentation are working properly - for every module/programming language separately.
And you can check if on other machine problem exists - maybe its something deeper, like bad OS env settings (incorrect PATH in Linux can be really annoying).
If it will not help, then you can try to launch VScode in --verbose mode, which will write all log information in the terminal. To do it
code --verbose
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.