The error message "ng: command not found" popped up despite successfully installing the latest @angular/cli using npm linking

Here is the information about my current setup:

Node version: v10.15.3

NPM version: 6.4.1

I attempted to run the following command:

Command: npm i -g angular/cli

An error occurred while executing: npm ERR! /usr/local/bin/git ls-remote -h -t ssh://[email protected]/angular/cli.git

Then, I tried running this command:

Command: npm i -g @angular/cli

NPM encountered an error: path /Users/admin/.node_modules/bin/ng npm ERR! code EEXIST npm ERR! Refusing to delete /Users/admin/.node_modules/bin/ng: ../lib/node_modules/angular-cli/bin/ng symlink target is not controlled by npm /Users/admin/.node_modules/lib/node_modules/@angular/cli npm ERR! File exists: /Users/admin/.node_modules/bin/ng npm ERR! Move it away, and try again.

Answer №1

Ensure that the path in your Environment variable -> user variable is set up correctly, as shown below

In my case, the npm folder can be located at

C:\Users\yourusername\AppData\Roaming\npm

The npm folder contains all your installed packages such as angular cli, webpack, and more.

Answer №2

To successfully install Angular, make sure to run the installation process with administrator privileges and use the global flag -g.

npm install -g @angular/cli

Once installed, verify the version of Angular by running:

ng --version

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

Setting up various connections is made possible through Node.js Socket.io

In the process of developing a straightforward chat application using socket.io and incorporating passport.js for user authentication, an issue arises when users log out and then back in. The previous socket connection remains active, resulting in two conn ...

Sorting nested table rows in vueJS is an essential feature to enhance

I am working with a json object list (carriers) that looks like this: https://i.stack.imgur.com/0FAKw.png Within my *.vue file, I am rendering this using the following code: <tr v-for="carrier in this.carriers"> <td>{{ carrier.id ...

Sometimes the Navbar options fail to show up consistently on the Navbar bar

I recently launched my website at campusconnect.cc Unfortunately, I've noticed that when resizing the window, the navbar options are shifting up and down. Can anyone help me identify the issue and provide guidance on how to resolve it? ...

Is there a way to implement a collapse/expand feature for specific tags in React-Select similar to the "limitTags" prop in Material UI Autocomplete?

Utilizing the Select function within react-select allows me to select multiple values effortlessly. isMulti options={colourOptions} /> I am searching for a way to implement a collapse/expand feature for selected tags, similar to the props fun ...

Updating the background of a div in HTML through the power of JavaScript

I am having trouble changing the background of a DIV. I believe my code is correct, but it doesn't seem to be working. I suspect the error lies with the URL parameter, as the function works without it. Here is my code: <script language="JavaS ...

Setting up yeoman-generator only to realize it's nowhere to be found

Every time I try to install yo generator like angular, angular-fullstack, cg-angular using these commands: npm install -g generator-angular npm install -g generator-angular-fullstack npm install -g generator-cg-angular I encounter an issue when trying to ...

Identify and handle errors effectively using TypeScript

I have a question regarding my Express server setup. Here is the code snippet: import express from "express"; import helmet from "helmet"; import cors from "cors"; const app = express(); app.use(helmet()); app.use(cors()); a ...

The successful execution of $.ajax does not occur

Starting out with ajax, I wanted to create a simple add operation. Here is the code that I came up with: HTML: <!doctype html> <html> <head> <title>Add two numbers</title> <meta content="text/html;charset=utf-8" h ...

I haven't encountered any type warnings in the places where I anticipated them

When I define an object like this: const x: { str: string, num: number } = { str: str, num: not_a_num }; I am surprised to find that even though 'not_a_num' is a string and not a number, the compiler does not throw an error. Instead, ...

Getting content from a URL and storing it using Firebase Storage and Cloud Functions: a complete guide!

I have a real-time database where users can input the URL of an image. After triggering a cloud function upon creation/update, I am able to read the image's URL from the real-time database. Now, my goal is to download the image from the web (not uplo ...

What is the best way to deal with a "Access to restricted URI denied" error in JavaScript while utilizing XMLHttpRequest?

Here is some code I am working with: var req = new XMLHttpRequest(); req.onload = function(){ if (req.status === "200"){ doSomethingWithTheReceivedData(); } else { alert("Error msg"); } }; When running index.html directly ...

I'm encountering an error in TestCafe that says "TypeError: Cannot read properties of undefined (reading 'match')". Which specific segment of my code is causing this issue?

retrieveUrlFromEmailData(emailData:any){ const emailContent = emailData.email_text; const urlPattern = /(https?:\/\/[^\n]*)/; const foundUrl = emailContent.match(urlPattern)[0]; return foundUrl } ...

Updating Bootstrap Indicators with jQuery on Click Event

Unfortunately, I am unable to share an image due to limited internet data. My goal is to switch each image to its sprite equivalent. There are three list items that I'm struggling to change because they each have two classes that need to be updated. ...

Looking for assistance with jqGrid

Is there a method to confirm if the grid has finished loading using a separate function? My goal is to automatically click on the first row and move that row to the second grid once this action occurs. jQuery("#search_grid").jqGrid('setGridParam&apo ...

Tips for resolving the unmounted component issue in React hooks

Any suggestions on resolving this issue: Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect ...

The distinction between storing data and component data becomes apparent when using Vuex in conjunction with a persisted state

Below is my post.js file in the store directory: import axios from 'axios' import createPersistedState from "vuex-persistedstate" export default { namespaced: true, state: { sample_data: 'Welcome!!', l ...

Is there an equivalent function to onAdd in Material-UI when using MUI Chip?

In my exploration of the latest version of Material-UI, MUI, I observed that the "onAdd" property has been removed. The only function properties remaining are "onDelete" and "onClick". I am interested in generating new chips based on user-input tags. Is ...

The Azure pipeline will publish an npm package only if the version of the package is more recent than that currently available in the npm registry

When following the quick start guide for Azure DevOps Services with npm, it emphasizes in Step 6: Publish an npm package the importance of checking if the package name/version already exists in the public registry on npmjs.com before publishing: "If you h ...

Limiting zero is ineffective when it comes to pop-up issues

Hey there, I'm looking to prevent users from inputting zero and dot in a specific field, which is currently working fine. However, when the field is within a pop-up, the code below doesn't seem to work. <script> $('#name').keyp ...

JavaScript code for downloading data through AJAX and then loading a chart is not functioning as expected

<script> var highchartsOptions = { chart: { backgroundColor: 'rgba(255, 255, 255, 0.1)', type: 'column' }, title: { text: '' }, exporting: ...