unable to reinstall due to removal of global typing

After globally installing Moment typing with the command

typings install dt~moment --save --global

Checking the installed typings using typings list shows:

├── <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="93fffcf7f2e0fbd3a7bda3bda3">[email protected]</a>
├── es6-shim (global)
└── moment (global)

Deciding to uninstall it globally with

typings uninstall moment --global

Another check of the typings list displays:

├── <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="630f0c0702100b23574d534d53">[email protected]</a>
└── es6-shim (global)

Trying to install in the current directory using typings install dt~moment --save results in an error message:

typings ERR! message Attempted to compile "moment" as an external module, but it looks like a global module. You'll need to enable the global option to continue.

Frustrated by this issue, I also attempted to clear the cache without success.

node v5
npm v3.3.9
tsc v1.8.10

Answer №1

Update: Consider upgrading to TypeScript 2.0 in order to easily install typings using npm.

npm install @types/moment

Read more here for the future of declaration files Visit this link to access @types/moment on npm

This information may provide some assistance.

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

Encountering a "args" property undefined error when compiling a .ts file in Visual Studio Code IDE

I've created a tsconfig.json file with the following content: { "compilerOptions": { "target": "es5" } } In my HelloWorld.ts file, I have the following code: function SayHello() { let x = "Hello World!"; alert(x); } However ...

Encountered difficulties when attempting to install Angular Universal in my angular13 application

I'm facing some challenges while trying to incorporate @nguniversal/ into my angular 13 application. Are there any experts who can offer assistance? Angular CLI: 13.0.4 Node: 16.13.1 Package Manager: npm 8.1.2 npm ERR! code ERESOLVE npm ERR! ERESO ...

Adding elements to a page while it is running can be achieved using a variety

Working on a college project, I am developing a demo web-app in Angular. The goal is to implement a feature where clicking a button adds a new node to the DOM tree. In JavaScript, a simple solution would be: document.getElementById('ticket-container& ...

Found in the NgModule.imports section of the AppModule, yet was unable to be identified as an NgModule class in Angular version 12.2.9

Just set up a fresh angular 12 application and installed version 12 of @angular/material. Now I'm trying to implement it by adding this basic element: <mat-drawer-container></mat-drawer-container> However, all I see in the browser is a wh ...

When attempting to replace the outdated Angular 2 router with the new Router, I encountered an error

I have the main app component and I want to add subroutes under the admin component like /admin/users, /admin/subscribers @Component({ selector: 'my-app', template: `<router-outlet></router-outlet>` directives: [ROUTER_DI ...

Retrieve information for the designated page exclusively

When retrieving data from the backend using a service, I encounter an issue where the system may slow down if 2000 records are returned in one request. To address this, I would like to display only 10 records per page and fetch the next 10 records with eac ...

Automatically arrange TypeScript import statements in alphabetical order in WebStorm / PhpStorm

I am using tslint with the default config tslint:recommended and I am looking to minimize the number of rules I need to customize. Some rules require that imports be alphabetized: src/core/task/TaskMockDecorator.ts[2, 1]: Imports within a group must be a ...

The most efficient and hygienic method for retrieving a value based on an observable

Looking at the structure of my code, I see that there are numerous Observables and ReplaySubjects. When trying to extract a value from one of these observables in the HTML template, what would be the most effective approach? In certain situations, parame ...

Discover the steps to sign up for src updates in an Angular 7 iframe

Seeking a method to subscribe to the src (url) change within an IFrame in an Angular 7 Application. Is there a way to capture the src Change event? ...

Handling JSON Data in JavaScript

In the script below, I have a json object that is being processed: $http({ url: '/mpdValidation/mpdValidate', method: "POST", data: { 'message' : mpdData } ).then(function(response) { console.log(response.data ...

Angular - Showing validation messages post successful execution of two functions

I have encountered an issue with my form submission process involving two functions. When both functions succeed, I want to display a successful validation message. However, currently the success message is displayed even if the second function fails. How ...

Encountering the error message: ERESOLVE unable to solve dependency tree while trying to install

I'm encountering an error when attempting to install a dependency. How can I resolve this issue? npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: <a href="/cdn-cgi/l/email-protection" cla ...

Tips for ensuring the angular FormArray is properly validated within mat-step by utilizing [stepControl] for every mat-step

When using Angular Material stepper, we can easily bind form controls with form groups like [stepControl]="myFormGroup". But how do we bind a FormArray inside a formGroup? Constructor constructor(private _fb: FormBuilder){} FormArray inside For ...

SwitchMap in Typescript allows you to switch to a

In my TypeScript code, I have implemented multiple interfaces, components, and a key/interface map. interface FooProps { 'keyInFoo': string } const Foo = (props: FooProps) => {} interface BarProps { 'keyInBar': string } cons ...

Tips on transferring a child Interface to a parent class

Here is my code snippet: LocationController.ts import {GenericController} from './_genericController'; interface Response { id : number, code: string, name: string, type: string, long: number, lat: number } const fields ...

Tips for sending a function with arguments in a React application using TypeScript

Is there a way to streamline passing a handleClick function to the son component so that it does not need to be repeated? The code in question is as follows: Mother Component: const Mother = () => { const [selectedOption, setSelectedOption] = useSt ...

TypeError: Unable to access the 'classify' property of an object that has not been defined (please save the ml5.js model first)

In my React app, I have set up ml5.js to train a model by clicking on one button and make predictions with another. However, I encounter an error when trying to test the model for the second time: TypeError: Cannot read property 'classify' of und ...

In regards to receiving updated data with Angular 4

As a newcomer to Angular4, I have a question regarding fetching subscribed data. Within this component, there is a method called makeTableInfo(). This method is used to generate a primeng turbotable. I am trying to access column data and row data within ...

Error when attempting to add data into MongoDB using Node.JS: "The type 'string' cannot be assigned to type 'ObjectId | undefined'."

Attempting to add a document to the collection results in an error when specifying the _id field of the added document. How can I insert a document with an _id that is not an ObjectId? The error occurs with the following code. Omitting the _id resolves th ...

Creating objects based on interfaces

After looking at this straightforward code: interface int1 { aa: string, bb: number, } const obj1:int1 = {} //#1 function fun(param_obj:int1) { //#2 } I am curious as to why the compiler throws an error: Type '{}' is missing the fol ...