简体   繁体   English

使用gulp编译打字稿找不到全局安装的打字稿包

[英]Using gulp to compile typescript can't find globally installed typescript package

I've been trying to set up a Gulp task in Visual Studio 2015 for a new Asp.Net 5 project, to compile my typescript in to javascript. 我一直在尝试在Visual Studio 2015中为新的Asp.Net 5项目设置Gulp任务,以将我的打字稿编译为javascript。 I had initial issues with conflicts with the Typescript definition files I'd installed using tsd, but following the answer to this question , I removed the Typescript node module from the project and installed it globally. 最初我与使用tsd安装的Typescript定义文件存在冲突,但是在回答了这个问题之后 ,我从项目中删除了Typescript节点模块并进行了全局安装。

However, now the gulp task complains that it can't find the typescript module, and it's looking for it in the folder I've just removed from the project. 但是,现在gulp任务抱怨说找不到typescript模块,而是在我刚刚从项目中删除的文件夹中寻找它。 I'm guessing I've missed something, but I can't work out what. 我猜我错过了一些东西,但我无法解决。

Update: 更新:

I've set an environment variable NODE_PATH to point to the global packages folder, but that's not made a difference. 我已经设置了一个环境变量NODE_PATH来指向全局包文件夹,但这并没有改变。 I'm guessing that the dependency that gulp-tsc has got to the typescript package isn't being redirected to the global package? 我猜gulp-tsc对typescript包的依赖关系没有重定向到全局包吗?

but following the answer to this question, I removed the Typescript node module from the project and installed it globally. 但是在回答了这个问题之后,我从项目中删除了Typescript节点模块,并将其全局安装。

Just install it locally and exclude (docs https://github.com/Microsoft/TypeScript/wiki/tsconfig.json#examples ) the node_modules folder 只需在本地安装它,并exclude (docs https://github.com/Microsoft/TypeScript/wiki/tsconfig.json#examples)node_modules文件夹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM