根据this guide,我已经运行rxjs-5-to-6-migrate -p src/tsconfig.app.json
。它显示以下错误。我已经完成了所有前面的步骤,没有任何问题。有任何线索吗?
注意: :我已删除node_modules
文件夹并运行npm i
。但是还没有运气。
>rxjs-5-to-6-migrate -p src/tsconfig.app.json
Running the automatic migrations. Please, be patient and wait until the execution completes.
module.js:549
throw err;
^
Error: Cannot find module 'typescript'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\lokuge\AppData\Roaming\npm\node_modules\rxjs-tslint\node_modules\tslint\lib\linter.js:22:10)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
child_process.js:644
throw err;
^
Error: Command failed: "C:\Users\lokuge\AppData\Roaming\npm\node_modules\rxjs-tslint\node_modules\.bin\tslint" -c "C:\Users\lokuge\AppData\Roaming\npm\node_modules\rxjs-tslint\rxjs-5-to-6-migrate.json" -p "src/tsconfig.app.json" --fix
module.js:549
throw err;
^
Error: Cannot find module 'typescript'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\lokuge\AppData\Roaming\npm\node_modules\rxjs-tslint\node_modules\tslint\lib\linter.js:22:10)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at checkExecSyncError (child_process.js:601:13)
at Object.execSync (child_process.js:641:13)
at migrate (C:\Users\lokuge\AppData\Roaming\npm\node_modules\rxjs-tslint\rxjs-5-to-6-migrate.js:18:34)
at Object.<anonymous> (C:\Users\lokuge\AppData\Roaming\npm\node_modules\rxjs-tslint\rxjs-5-to-6-migrate.js:25:14)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
答案 0 :(得分:3)
我找到了解决方案。
npm install -g typescript