打字稿问题编译VS代码扩展

时间:2019-02-05 16:50:16

标签: node.js typescript visual-studio-code

我正在尝试编译我编写的VS Code扩展,但是遇到了一些错误,我认为这些错误是由于TypeScript配置不正确造成的。

如果我从扩展名目录的根目录运行vsce package,则会收到以下错误输出:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\myUsername\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'compile' ]
2 info using npm@6.4.1
3 info using node@v10.13.0
4 verbose run-script [ 'precompile', 'compile', 'postcompile' ]
5 info lifecycle dxdevcheck@0.0.1~precompile: dxdevcheck@0.0.1
6 info lifecycle dxdevcheck@0.0.1~compile: dxdevcheck@0.0.1
7 verbose lifecycle dxdevcheck@0.0.1~compile: unsafe-perm in lifecycle true
8 verbose lifecycle dxdevcheck@0.0.1~compile: PATH: C:\Users\myUsername\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\myUsername\Desktop\dxdevcheck\node_modules\.bin;C:\Users\myUsername\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\myUsername\Desktop\dxdevcheck\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CheckPoint\Endpoint Security\Endpoint Common\bin;C:\windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files\1E\NomadBranch\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\Common Files\Hitachi ID\;C:\Program Files\Common Files\Hitachi ID\;C:\Program Files\Common Files\M-Tech\;C:\Program Files\nodejs\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CheckPoint\Endpoint Security\Endpoint Common\bin;C:\Program Files\1E\NomadBranch\;C:\Program Files (x86)\Common Files\M-Tech\;C:\Program Files\Common Files\M-Tech\;C:\Users\myUsername\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:;C:\Users\myUsername\AppData\Roaming\npm;C:\Program Files\Salesforce CLI\bin;C:\Program Files\Git\bin;C:\Program Files\Java\jdk1.8.0_181\bin;C:\Program Files\nodejs;C:\Users\myUsername\AppData\Local\sfdx\client\bin;C:\Program Files\Java\jdk1.8.0_192\bin;C:\Program Files\Java\jre1.8.0_192\bin;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8
9 verbose lifecycle dxdevcheck@0.0.1~compile: CWD: C:\Users\myUsername\Desktop\dxdevcheck
10 silly lifecycle dxdevcheck@0.0.1~compile: Args: [ '/d /s /c', 'tsc -p ./' ]
11 silly lifecycle dxdevcheck@0.0.1~compile: Returned: code: 2  signal: null
12 info lifecycle dxdevcheck@0.0.1~compile: Failed to exec compile script
13 verbose stack Error: dxdevcheck@0.0.1 compile: `tsc -p ./`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\myUsername\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\myUsername\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid dxdevcheck@0.0.1
15 verbose cwd C:\Users\myUsername\Desktop\dxdevcheck
16 verbose Windows_NT 10.0.16299
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\myUsername\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "compile"
18 verbose node v10.13.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 2
22 error dxdevcheck@0.0.1 compile: `tsc -p ./`
22 error Exit status 2
23 error Failed at the dxdevcheck@0.0.1 compile script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

TypeScript编译器位置不在我的系统路径上,但是如果我手动将编译器的路径手动添加到Windows上的用户环境变量中,然后在Powershell控制台中运行tsc -v,则我的版本为1.8.34

将TypeScript路径永久添加到系统PATH可以解决此问题吗?

0 个答案:

没有答案