Having trouble with Angular CLI on your Windows 10 system?

Recently, I reinstalled node.js, npm, and angular-cli on my Windows 10 PC. However, after installing angular-cli using the command npm install -g @angular/cli, I encountered an issue. Despite having node.js version 8.1.2 and npm version 5.0.3, whenever I try to run any command starting with ng, I receive the following error:

module.js:487
throw err;
^

Error: Cannot find module '@ngtools/json-schema'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\Raphaël\AppData\Roaming\npm\node_modules\@angular\cli\models\config\config.js:6:23)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)

Does anyone have any insights into what might be causing this issue?

Answer №1

Just a hunch, but I've heard that using -g installs can cause issues with your local angular cli. It seems like you might be missing a module from the download, potentially due to a lost package. You could try uninstalling and then re-installing it to see if that helps.

Answer №2

I am currently using Windows 10 with Node version 8.1.4 and npm version 5.2.0. I was able to resolve my issue by following the steps outlined in a discussion thread on GitHub: https://github.com/angular/angular-cli/issues/4425. This link provides detailed instructions:

1. Uninstall Angular CLI

npm uninstall @angular/cli -g

2. Install rxJS

npm install rxjs -g

3. Clear cache

npm cache clean

4. Manually delete contents from

%AppData%\npm\node_modules

5. Reinstall Angular CLI

npm install @angular/cli -g

Answer №3

To resolve the issue, consider reverting back to node v7 and npm v4 by executing these commands:

rm -rf node_modules dist

npm cache clear --force

npm install

Some discussions suggest deleting the package.lock file that comes with npm@5. Also, double-check your typescript version to ensure it is above 2.2.0.

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

Transmitting command-line arguments while utilizing node-windows for service creation

Recently, I developed some custom middleware in Node.js for a client that functions well in user space. However, I am now looking to turn it into a service. To achieve this, I utilized node-windows, which has been effective so far. The only issue is that ...

There was an error when attempting to upload a file through Express: "The property file cannot be read because

My current challenge involves uploading a file using a form in JADE: form(action="/file-upload", name="upload", method="post", enctype="multipart/form-data") input(type="file", name="theFile") input(type="submit", name="Upload") This is how I hav ...

Redirecting to child routes based on conditions

I encountered a situation where I need to lazily load child routes and display them conditionally: const routes: Routes = [ { path: '', component: MainComponent, canActivate: [AuthGuard], children: [ { path: &apos ...

What is the best way to show the previous month along with the year?

I need help with manipulating a date in my code. I have stored the date Nov. 1, 2020 in the variable fiscalYearStart and want to output Oct. 2020. However, when I wrote a function to achieve this, I encountered an error message: ERROR TypeError: fiscalYear ...

What is Angular's approach to handling a dynamic and unprocessed JSON object?

When a JSON file is placed under assets, accessing it using something like http://localhost:4200/myapp.com/assets/hello.json will fetch the JSON file directly without any graphical user interface. This indicates that Angular must be able to return a raw JS ...

Having trouble with Angular's ng-tags-input? Are you getting the error message "angular is not defined"? Let

I recently created a new Angular project using the following command: ng new "app-name" Now, I'm attempting to incorporate ngTagsInput for a tag input feature. However, every time I try to build and run my app, I encounter an error in my browser con ...

Advancing the utilization of custom Angular input fields

I've developed a unique Angular input element that utilizes a textarea as its primary input field. Is there a way for me to pass along the enter key event to the main form? ...

What is the process for including additional information in a JSON file?

I've been searching for a while now and couldn't find the right solution, so I'm posting my issue here. I am trying to add some data (an object) to a .json file, but each time I add more data, it ends up getting messed up. Here's the co ...

Node.js and Express.js are being used in conjunction with Angular to create a server-side controller that fetches all data. However, there seems to be an issue as the

"findByStaff" and "findOne" are working correctly, however, "findAll" is not returning any data. I expected findAll to retrieve all courses from mongodb $scope.findByStaff = function() { $scope.courses = Courses.query(); }; $scope.fin ...

Angular Reactive Forms: Implementing Error Display and Red Border Styling

Recently, I've started diving into Angular Reactive Forms and I'm quite impressed by the async validator feature for tasks that involve checking data against a database. The separation of validation rules from the GUI is also very appealing to me ...

Looking to include an additional field in mongoose documents when generating a JSON object in a Node.js application?

var commentSchema = new Schema({ text: String, actions:[{actionid:String, actiondata:String}], author: String }) When retrieving the records, I require a count for action = 1. The desired outcome is to include this count as an additional key ...

After upgrading from version 8 to 9, Nest is struggling to resolve the dependencies of the XXX component

My Nestjs application has stopped working after upgrading from version 8 to 9.2.1 Following the upgrade, I am encountering the error message: "Nest can't resolve dependencies of the XXX" in all my resources. Prior to the upgrade, everything was funct ...

A guide to handling react-router endpoints seamlessly on an express/node server

In my React frontend application, I am using react-router. The app is served from a directory called "/build" on my Express server. All back-end functionality (such as database operations) are handled by an endpoint at "localhost:3003/api/something", while ...

Angular and KeyCloack - Automatically redirect to specific route if user's role does not have access permissions

I am currently working on implementing a mechanism to redirect unauthorized roles when attempting to access restricted routes using the keycloack-angular library: npm install keycloak-angular keycloak-js Custom Guard Implementation export class AuthGuar ...

Troubleshooting Block-scoped errors on Heroku using Node.js and Express

Currently, I am working with node.js and express on the Heroku platform. While working on the route file, I encountered an issue when using the let keyword. The error message displayed was: SyntaxError: Block-scoped declarations (let, const, function, cla ...

Encountering problem while upgrading Angular Material from version 13 to 14 - error TS2307: Module '@angular/material/core/common-behaviors/constructor' not found

While upgrading Angular and Angular Material from version 13.2.6 to 14.2.2, I encountered the following challenges: Error TS2307: Module '@angular/material/core/common-behaviors/constructor' or its type declarations cannot be found. Error TS2345 ...

Error message: `Socket.io-client - Invalid TypeError: Expected a function for socket_io_client_1.default`

I have successfully installed socket.io-client in my Angular 5.2 application, but after trying to connect (which has worked flawlessly in the past), I am encountering a strange error. TypeError: socket_io_client_1.default is not a function at new Auth ...

Exploring the Power of TypeScript with NPM Packages: A Comprehensive Guide

I am working with a "compiler" package that generates typescript classes. However, when I attempted to run it using npm, an unexpected error occurred: SyntaxError: Unexpected token export To avoid the need for compiling local files, I do not want to con ...

Changes on services do not affect the Angular component

Currently facing an issue with my Angular assignment where changing an element's value doesn't reflect in the browser, even though the change is logged in the console. The task involves toggling the status of a member from active to inactive and ...

The items are not displayed in the app.component.html file

I am having trouble displaying the product list in an HTML file. Despite receiving the product data in a JavaScript message, it is not showing up when I try to list it in the HTML. Can anyone assist me in resolving this issue? Below is the code snippet: im ...