Tips for reverting from Angular 7 to Angular 6

I attempted to switch from angular 7 back to angular 6 by executing the following npm commands:

npm uninstall -g angular-cli
npm cache clean
npm install -g <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="32535c55475e53401f515e5b5e57">[email protected]</a>

Despite this, my package.json file continues to show angular/cli version 7. I'm in need of guidance on how to successfully revert from angular7 to angular6.

Answer №1

To ensure compatibility, it is important to update the version numbers in your package.json for the following packages:

"@angular/animations": "^7.0.0",
"@angular/cdk": "7.3.3",
"@angular/common": "^7.0.0",
"@angular/compiler": "7.2.6",
"@angular/core": "7.2.6",
"@angular/forms": "^7.0.0",
"@angular/http": "^7.0.0",
"@angular/material": "7.3.3",
"@angular/material-moment-adapter": "^7.3.3",
"@angular/platform-browser": "^7.0.0",
"@angular/platform-browser-dynamic": "^7.0.0",
"@angular/router": "^7.0.0",
"rxjs": "6.4.0",

Additionally, make sure to adjust version numbers in dev-dependencies as follows:

"@angular/compiler-cli": "^7.2.6",
"@angular-devkit/build-angular": "0.13.3",
"typescript": "3.2.4",
"@angular/cli": "~7.3.3",

It's also essential to downgrade any libraries that require downgrading based on Angular's version. Be sure to check error messages after completing this step...

After making these changes, execute:

rm -rf node_modules

In the project's root folder to remove all existing packages.

Next, run:

npm i 

This should resolve any compatibility issues and allow you to proceed smoothly with your project.

Answer №2

It seems like you may have overlooked adding the @ symbol before @angular/cli. Give these steps a try to implement the change globally:

ng --version

npm uninstall -g @angular/cli
npm cache clean --force

npm install -g @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cdaec1c4ea96bfbfbf">[email protected]</a>
ng --version

To apply the same change locally within your project folder, omit the -g:

Alternatively, you can manually modify the package.json file, delete the node_modules folder, and then execute npm install in your project directory.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using System.import in my code is triggering a cascade of errors in my console

I incorporate the System module in my component. export class LoginComponent { constructor() { System.import('app/login/login.js'); } } The file loads successfully, however, TypeScript compiler raises an error Error:(10, 9) TS2 ...

Is there a more effective alternative to using the ternary condition operator for extended periods of time?

Do you know of a more efficient solution to handle a situation like this? <tr [style.background]="level == 'ALARM' ? 'violet' : level == 'ERROR' ? 'orange' : level == 'WARNING' ? 'yellow' ...

What is the best way to incorporate a hyperlink in a React project using Tailwind

I am working on a project using React and Tailwind CSS. I want to be able to redirect the user to the next page when they click on a link. I have tried using the <a /> tag, but I'm not seeing any noticeable difference between that and the <p ...

Unable to display results in React Native due to FlatList not being shown

I'm a beginner to React Native and I'm attempting to create a simple flatlist populated from an API at , but unfortunately, no results are displaying. Here's my App.tsx code: import React from 'react'; import type {PropsWithChildre ...

What is the best way to interpret the data from forkjoin map?

As a newcomer to angular and rxjs, I am seeking guidance on how to properly retrieve data from forkJoin using a map function. ngOnInit(): void { this.serviceData.currentService.subscribe(service => this.serviceFam.getAllFamilles().pipe( ...

Deploying Vue.js applications

I am working on a Vue application that was created using vue-cli. It is semi-developed and I would like to show the progress to a customer. Therefore, I am looking to deploy what we have so far. If I execute the script npm run build, will I still be able ...

What is the process for assigning global or environment variables to my personal npm package or node module within a project?

I created my own npm package for React, which we'll call @group/package. Within this package, I developed exportable hooks. One example is a hook called useFetchWithRefreshToken. This hook always calls the same API_URL, but the specific URL depends on ...

Leveraging Services in Classes Outside of Angular's Scope

I have a scenario where I am working with Angular v7.3.5 and I need to utilize a Service in a non-Angular class. Below is an example of what I'm trying to achieve: foo.model.ts import { Foo2Service } from './foo2.service'; // Definition fo ...

Ways to change a value into int8, int16, int32, uint8, uint16, or uint32

In TypeScript, the number variable is floating point by default. However, there are situations where it's necessary to restrict the variable to a specific size or type similar to other programming languages. For instance, types like int8, int16, int32 ...

Does the routing in Angular 2 get disrupted by parameter breaks in sub-modules?

In my Angular 2 application, I am encountering an issue with routing to my line module. Currently, I have two submodules - login and line. The routing to the login submodule is working well. However, when I attempt to route to the line module with route pa ...

Every time I try to run npm install followed by npm start, I keep getting bombarded with the same set of messages

namish@namishs-mbp ~ % npm install npm encountered some warnings during the installation process: - ENOENT: no such file or directory, open '/Users/namish/package.json' - No description - No repository field - No README data - No license field S ...

Display the default text using ngx-translate if a key is not found or while the translation file is loading

Currently in the process of setting up a brand new Angular 7 application. I am interested in establishing a default text for translation purposes. Specifically, when utilizing the translation {{ 'wait' | translate }}, I would like to ensure that ...

Error encountered: Unable to locate module 'psl'

I'm encountering an issue when trying to execute a pre-existing project. The error message I keep receiving can be viewed in the following error logs image Whenever I attempt to run "npm i", this error arises and I would greatly appreciate it if some ...

What is the method for launching Chrome synchronously in Selenium WebDriver using createSession()?

After executing the code below using Selenium WebDriver to launch a Chrome browser: import { Driver } from 'selenium-webdriver/chrome'; Driver.createSession(); console.log("I've launched!"); I'm encountering an issue where "I've ...

Swagger is refusing to cooperate because my model's attributes are set to true

Currently delving into Swagger and its documentation functionality through a YAML file. Previously, I had used @swagger in the controller file and everything worked fine. However, when attempting to transition to a YAML file for better organization, issues ...

Is there a way to determine if a string is empty, even if it contains hard returns?

I am currently working on a function that checks if a string is empty or not, but it seems to be missing the detection of new lines. export const isStrEmpty = function(text: string): boolean { return !text || text.match(/^ *$/) !== null; }; I attempted ...

The member 'email' is not found in the promise type 'KindeUser | null'

I'm currently developing a chat feature that includes PDF document integration, using '@kinde-oss/kinde-auth-nextjs/server' for authentication. When trying to retrieve the 'email' property from the user object obtained through &apo ...

After compiling the code, a mysterious TypeScript error pops up out of nowhere, despite no errors being

Currently, I am delving into the world of TypeScript and below you can find the code that I have been working on: const addNumbers = (a: number, b: number) => { return a + b } Before compiling the file using the command -> tsc index.ts, the ...

Ways to implement logging in an NPM package without the need for a specific logging library

Currently, I am in the process of developing a company npm package using TypeScript and transferring existing code to it. Within the existing code, there are instances of console.log, console.warn, and console.error statements, as shown below: try { c ...

When you hover over the button, it seamlessly transitions to a

Previously, my button component was styled like this and it functioned properly: <Button component={Link} to={link} style={{ background: '#6c74cc', borderRadius: 3, border: 0, color: 'white', height: 48, padding: '0 ...