正确使用rxjs-5-to-6进行迁移。 tsconfig路径问题

时间:2018-06-28 18:52:50

标签: angular rxjs rxjs5 tsconfig rxjs6

使用rxjs-5-to-6-migrate的文档指出以下内容:

To refactor TypeScript code so that it doesn't depend on rxjs-compat, you can use rxjs-tslint.

npm i -g rxjs-tslint
rxjs-5-to-6-migrate -p [path/to/tsconfig.json]

所以我这样做了,然后复制了

我的tsconfig文件的根路径

rxjs-5-to-6-migrate -p [/home/ri
ckus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/frontendsuitsandtables/suitsandtables/tsconfig.json]

但是当我运行命令时,出现以下错误

Running the automatic migrations. Please, be patient and wait until the execution completes.
child_process.js:643
    throw err;
    ^

Error: Command failed: "/usr/local/lib/node_modules/rxjs-tslint/node_modules/.bin/tslint" -c "/usr/local/lib/node_modules/rxjs-tslint/rxjs-5-to-6-migrate.json" -p "[home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/frontendsuitsandtables/suitsandtables/tsconfig.json" --fix
    at checkExecSyncError (child_process.js:603:11)
    at Object.execSync (child_process.js:640:13)
    at migrate (/usr/local/lib/node_modules/rxjs-tslint/rxjs-5-to-6-migrate.js:18:34)
    at Object.<anonymous> (/usr/local/lib/node_modules/rxjs-tslint/rxjs-5-to-6-migrate.js:25:14)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Module.require (internal/modules/cjs/loader.js:650:17)

但是为什么呢?似乎这段代码比我的前任更加善变,不幸的是我无法逃脱。

我检查了这个答案,但没有帮助: RxJs-5-to-6-migrate crashes

1 个答案:

答案 0 :(得分:0)

请勿在{{1​​}}的路径周围添加方括号。

tsconfig.json

您还可以在项目的源根目录内启动命令(第一步是可选的,如果您已经在文件夹中)。

rxjs-5-to-6-migrate -p /home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/frontendsuitsandtables/suitsandtables/tsconfig.json