问题
In the upgrade process from update.angular.io:
Remove deprecated RxJS 6 features using rxjs-tslint auto update rules.
For most applications this will mean running the following two commands:
npm install -g rxjs-tslint rxjs-5-to-6-migrate -p src/tsconfig.app.json
But when I follow these steps and run rxjs-5-to-6-migrate -p src/tsconfig.app.json I'm getting the error:
rxjs-5-to-6-migrate: command not found
Is there any reason why this command isn't working?
回答1:
I did get it working and my steps are the following:
- Install
rxjs-tslintlocally -cd YOUR_PROJECT_DIR && npm i rxjs-tslint. - Then run from your project root
node_modules/.bin/rxjs-5-to-6-migrate -p PATH_TO_YOUR_TSCONFIG.json. - If you get an error saying something like
rxjs-tslint/node_modules/.bin/tslint: not found, then docd node_modules/rxjs-tslint && npm installand repeat the step 2.
回答2:
Follow the instruction to install the dependency globally then try using the full path to the file rxjs-5-to-6-migrate.
For example:
/usr/local/lib/node_modules/rxjs-tslint/bin/rxjs-5-to-6-migrate -p src/tsconfig.app.json
If you don't know where the dependencies are stored on your computer you can run npm root -g
回答3:
When I got this, I had to follow the following steps. They took me a while to figure out, so I figure I should share them here:
- run
npm install rxjs-tslist - run
cd node_modules/rxjs-tslint - run
npm install cdback out of yournode_modulesdirectory, back to your project home- run
rxjs-5-to-6-migrate -p ./tsconfig.json
On step #5 you make need to change the path to point to your tsconfig.json file. But that is where mine was. It finally worked!
Hope it works for you like it worked for me.
来源:https://stackoverflow.com/questions/50330546/angular-6-update-rxjs-5-to-6-migrate-command-not-found