首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ts-node --version运行的时间非常长

ts-node --version运行的时间非常长
EN

Stack Overflow用户
提问于 2019-10-25 02:26:52
回答 1查看 70关注 0票数 0

一个简单的ts-node --version需要很长的执行时间

我有一个新的虚拟maschine (xen,20 of内存,大量可用空间)和ubuntu 18.04服务器。通过包管理器安装节点/npm。不幸的是,执行一个简单的ts-node --版本需要很长的时间才能完成:

代码语言:javascript
复制
time ./node_modules/.bin/ts-node --version
ts-node v7.0.1
node v8.10.0
typescript v3.6.4
cache "/tmp/ts-node-94a6b447580330f9f2b609422537b04239ff3a39df9137e32efd559f1a2935cb/9d1b7d973ebcaeec54cd97f2de9eb4549430f03609c30b1504d897556bb2d5af"

real    2m44,511s
user    0m32,442s
sys     0m19,245s

使用本地虚拟maschine (ubuntu 18.04,但虚拟机器,只有6 6GB内存),同样的请求需要不到一秒钟的时间:

代码语言:javascript
复制
time ./node_modules/.bin/ts-node --version
ts-node v7.0.1
node v8.10.0
typescript v3.6.4
cache "/tmp/ts-node-1da900a950c0ee3f0f80ae0bb561a80b80e89de692835d79984eb12d0a2f2a44/ca51062b04b699dcb91ec472983c8d598ee9fb43791553c229cba71256858f5a"

real    0m0,918s
user    0m0,840s
sys     0m0,083s

./node_modules/.bin/ts-node --help真的很快。

如果我查看./node_modules/.bin/ts-node (指向../ts-node/dist/bin.js的链接),则会出现以下问题:

代码语言:javascript
复制
var service = index_1.register({
    files: argv.files,
    pretty: argv.pretty,
    typeCheck: argv.typeCheck,
    transpileOnly: argv.transpileOnly,
    cache: argv.cache,
    cacheDirectory: argv.cacheDirectory,
    ignore: argv.ignore,
    project: argv.project,
    skipIgnore: argv.skipIgnore,
    skipProject: argv.skipProject,
    compiler: argv.compiler,
    ignoreDiagnostics: argv.ignoreDiagnostics,
    compilerOptions: index_1.parse(argv.compilerOptions) || index_1.DEFAULTS.com
pilerOptions,
    readFile: isEval ? readFileEval : undefined,
    fileExists: isEval ? fileExistsEval : undefined
});

我使用以下tsconfig.json:

代码语言:javascript
复制
{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es6",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "esModuleInterop": true
  },
  "exclude": ["node_modules"]
}

新鲜的npm install

版本:

代码语言:javascript
复制
node --version
v8.10.0

npm --version
3.5.2

也许有人有个想法..。

EN

回答 1

Stack Overflow用户

发布于 2019-10-25 21:13:33

我刚刚找到了这种奇怪行为的原因:项目目录包含一个指向一个巨大图像目录的链接,其中包含100k+图像文件。如果我删除链接,一切都会正常工作。

谢谢!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58547207

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档