I had been learning angular for sometime now and wanted to create a complete project and thus found one on ‘Pluralsight’, where the author specifically wanted the students to use the Node Package Manager (NPM) and the angular/cli of the specific versions he was using so that there would be no issues following the project he was building on there.
He mentioned to use : NPM 5.6.0 and angular/cli 6.0.8 and I was already having : NPM 6.4.1 and angular/cli 7.1.4, the latest when i installed them for practicing my readings and other tutorials. I had no issue on changing the version of NPM to be used thanks for the Node Version Manager (NVM) for windows available at this link :
but the real problem started for me when i wanted to uninstall the existing angular/cli and install the older one, i had two issues:
- The angular/cli was not getting uninstalled even after using the following commands (by the way, i am using Git Bash for this) :
$ npm uninstall -g @angular/cli
$ npm cache clean --force
$ npm cache verify
$ npm install -g @angular/cli
and finally what i did was to manually delete the @angular folder present at :
C:\Users{YOU}\AppData\Roaming\npm\node_modules
directory (AppData is a hidden folder) and now i was ready to install the required version of angular/cli globally and did it using the command:
$ npm install -g @angular/cli@6.0.8
and the NPMreturned with a successfully installed message and other details of where the angular/cli was installed. And now for the second issue,
- I was happy and wanted to check the version of my angular/cli now and typed in the command:
$ ng --version
and to my horror I was encountered with this :
Error: Cannot find module ‘C:\Users{YOU}\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng’
Luckily, as the error was clear I could understand that windows was not able to find the ‘Ng‘ module which I happened to have manually deleted previously and the other version of the angular/cli I installed was installed in another directory.
I crosschecked the successfully installed message and found out that it was installed in some other folder where my Git Bash was installed and thus without wasting any time I simply cut and pasted the @angular folder as-it-is from the installed folder into the directory :
C:\Users{YOU}\AppData\Roaming\npm\node_modules
and finally was satisfied after checking and finding out that the required version of the angular/cli I needed was installed and running.
Leave a comment