rxjs-tslint: Error when running rxjs-5-to-6-migrate
Installed rxjs-tslint
globally, attempting to upgrade my Angular application from version 5 to 6.
I’m using the command
rxjs-5-to-6-migrate -p src/tsconfig.app.json
But it results in this error
Running the automatic migrations. Please, be patient and wait until the execution completes.
child_process.js:644
throw err;
^
Error: Command failed: /usr/lib/node_modules/rxjs-tslint/node_modules/.bin/tslint -c /usr/lib/node_modules/rxjs-tslint/rxjs-5-to-6-migrate.json -p src/tsconfig.app.json --fix
at checkExecSyncError (child_process.js:601:13)
at Object.execSync (child_process.js:641:13)
at migrate (/usr/lib/node_modules/rxjs-tslint/rxjs-5-to-6-migrate.js:18:34)
at Object.<anonymous> (/usr/lib/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)
There are no spaces in the path to any of the files.
I have tried specifying the full path to tsconfig.app.json
, same result.
Linux Kubuntu 18.04 Node 8.11.1 NPM 6.0.0 Installed packages:
/usr/lib
├── @angular/cli@6.0.0
├── npm@6.0.0
├── rxjs-tslint@0.1.3
├── tslint@5.10.0
└── typescript@2.7.2
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 21
- Comments: 31
If you run an
npm install
from inside the rxjs-tslint package’s directory, it’ll make sure it hastslint
available. No need to be gross and install something globally.cd node_modules/rxjs-tslint
npm install
cd ../..
./node_modules/.bin/rxjs-5-to-6-migrate -p src/tsconfig.app.json
For bonus points, use
npx
to access the binary (I found out recently it ships with npm):npx rxjs-5-to-6-migrate -p src/tsconfig.app.json
In Angular Update Guide | 5.2 -> 6.0 for Advanced Apps checklist step
Choose a value of off for preserveWhitespaces in your tsconfig.json to gain the benefits of this setting while the default is still to preserve whitespace.
causes the problem.Running
rxjs-5-to-6-migrate -p ./src/tsconfig.app.json
(no matter global or local installed) an error occurred:executing
project_path/node_modules/rxjs-tslint/node_modules/.bin/tslint -c "project_path/node_modules/rxjs-tslint/rxjs-5-to-6-migrate.json" -p "./src/tsconfig.app.json" --fix
we get:tsconfig.json(10,5): error TS5023: Unknown compiler option 'preserveWhitespaces'.
so removing
preserveWhitespaces
solved the problem for me@cbchenoweth thanks for sharing! In such case, you should be able to workaround the issue by running:
@melodysummer If you want to run the “rxjs-5-to-6-migrate” command, I think you must also install this package globally. So:
npm install -g rxjs-tslint
Alternatively, you can just configure the tsLint rules in your project as described in the readme: https://github.com/ReactiveX/rxjs-tslint/blob/master/README.md#use-rules
@cbchenoweth correct
Same thing also on windows
Windows 10 Node 9.3.0 NPM 6.0.0
tslint@5.10.0 typescript@2.7.2 rxjs-tslint@0.1.3
I have the same issue.
Windows 10 Node 8.9.4 NPM 5.6.0
tslint@5.10.0 typescript@2.7.2 rxjs-tslint@0.1.3
I think the problem is another one. Look at into the /src if the name file is ''tsconfig.app.json" or is “tsconfig.json” In my case, i only changed to correct name.
Please check path of tsconfig.json. In my case it was src/tsconfig.app.json but i changed it to src/client/tsconfig.json and its working. So i did 2 changes
After installing tslint, typescript globally and locally - despite of false npm warnings about typescript missing - rxjs-5-to-6-migrate -p src/tsconfig.app.json helped. Documentation is bad - “rxjs-5-to-6-migrate -p [path/to/tsconfig.json]” is bad description. Cannot use tsconfig.json, cannot use “rxjs-5-to-6-migrate -p” without optional path. Have to use rxjs-5-to-6-migrate -p src/tsconfig.app.json.
Correct documentation.
On macOS it’s the same
I have this issue also when I try to update my Angular5 project to V7. After I tried all the above but still can’t get any thing done. Finally I found some clue other where, you should update your typescript globally as well, that seems works for me. Clue here: https://github.com/ReactiveX/rxjs-tslint/issues/49
Why it is necessary to call ‘npm install’ inside the ‘node_modules/rxjs-tslint’ folder? It works. But i dont understand why. When i call npm install rxjs-tslint, i assume, that all dependecies will be installed.
Can you explain me this, please?
@ziacik Thanks, your solution worked for me, running the failed command showed the actual error and now it is running 😃
However, this is what the angular update guide says which is why I added it in the first place, something doesn’t add up, as it seems like this is not a valid option in the tsconfig file
For me, running the failed command mentioned in the error manually, e.g.
/usr/lib/node_modules/rxjs-tslint/node_modules/.bin/tslint -c /usr/lib/node_modules/rxjs-tslint/rxjs-5-to-6-migrate.json -p src/tsconfig.app.json
, revealed me the real error.For me, it was a messed up tsconfig.json:
tsconfig.json(11,3): error TS5023: Unknown compiler option 'preserveWhitespaces'
Install globally as described in readme or use npx:
npx rxjs-5-to-6-migrate -p src/tsconfig.app.json
Please close this issue as it works as described in readme.
Ach hate these. One blog says run
this
, it doesn’t work and the creators have no idea.For a start it says run it against
src/tsconfig.app.json
But that file does not get generated by ng-cli there, it generates:
So which is it? FWIW ALL fail the same way and nothing suggested thus far solves it.
Love a simple upgrade path!
@mgechev ok, so, just to make sure my understanding is correct: The command “rxjs-5-to-6-migrate” is essentially just doing a “tslint --fix”?
So, as long as I did the steps to set up the rules directly in my tslint.json, the command is really not needed?