Having trouble with installing Typescript on a MacBook?

I have been attempting to follow the instructions provided on TypeScriptLang.org but for some reason, I am unable to successfully download typescript.

This is what I have tried so far:

mkotsollariss-MacBook-Pro:/ mkotsollaris$ which node
/usr/local/bin/node
mkotsollariss-MacBook-Pro:/ mkotsollaris$ which npm
/usr/local/bin/npm
mkotsollariss-MacBook-Pro:/ mkotsollaris$ npm install -g typescript
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└── <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bbcfc2cbdec8d8c9d2cbcffb89958a958e">[email protected]</a> 

npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "typescript"
npm ERR! node v6.9.4
npm ERR! npm  v3.10.10
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "typescript"
npm ERR! node v6.9.4
npm ERR! npm  v3.10.10
npm ERR! path npm-debug.log.3182471724
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open

npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.3182471724'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, open 'npm-debug.log.3182471724'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'open',
npm ERR!   path: 'npm-debug.log.3182471724' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /npm-debug.log
mkotsollariss-MacBook-Pro:/ mkotsollaris$ 

After trying to sudo the typescript installation:

mkotsollariss-MacBook-Pro:/ mkotsollaris$ sudo npm install -g typescript
Password:
/Applications/IBM/SoftwareDeliveryPlatform_1/cordova_cli/bin/tsc -> /Applications/IBM/SoftwareDeliveryPlatform_1/cordova_cli/lib/node_modules/typescript/bin/tsc
/Applications/IBM/SoftwareDeliveryPlatform_1/cordova_cli/bin/tsserver -> /Applications/IBM/SoftwareDeliveryPlatform_1/cordova_cli/lib/node_modules/typescript/bin/tsserver
/Applications/IBM/SoftwareDeliveryPlatform_1/cordova_cli/lib
└── <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fc88855fcc99980001784ccea2cdc2c9">[email protected]</a> 

mkotsollariss-MacBook-Pro:/ mkotsollaris$ which tsc
mkotsollariss-MacBook-Pro:/ mkotsollaris$ tsc
-bash: tsc: command not found
mkotsollariss-MacBook-Pro:/ mkotsollaris$ 

Any suggestions?

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

Utilizing ExpressJS in a NodeJS application with ES6 and Typescript

After confirming my information, I discovered that in an ES6 application, it is necessary to import dependencies using import .. from '..' instead of var .. = require('..'). I made the necessary changes to the imports, but encountered ...

Having trouble removing symbolic links even after executing npm link

After setting up some executable commands in my project and defining them in the bin property of the package.json, I performed a npm link. This created symlinks in the .nvm/versions/node/v16.13.0/bin directory (since I am using nvm). However, when I made ...

How to retrieve a random element from an array within a for loop using Angular 2

I'm in the process of developing a soundboard that will play a random sound each time a button is clicked. To achieve this, I have created an array within a for loop to extract the links to mp3 files (filename), and when a user clicks the button, the ...

Encountering a shell script parsing problem: Could it be an unexpected INVALID_CHARACTER due to Windows cmd shell quoting

What am I trying to accomplish? I have a JSON file called sonar-report.json. My goal is to iterate through the sonar-report.json in a shell script and extract values from the JSON file. To achieve this, I am using jq as my JSON parser (). Below is the cod ...

Encountered a Node Express Post 500 error (Internal Server Error) triggered by jquery-3.4.1.min.js

Recently, I've been immersed in developing a node js/express js application for quite some time. Most of my get's and post's are functioning properly when triggered from jquery $ajax calls. However, there seems to be an issue with one speci ...

JavaScript alert box

I'm fairly new to the world of web development, with knowledge in CSS & HTML and currently learning TypeScript. I'm attempting to create a message icon that opens and closes a notifications bar. Here's where I'm at so far: document.getE ...

Is there a way to define the length of children when performing props type checking?

I need my component to only allow for three children that are considered as type React.ReactChild. However, I'm uncertain if ReactChild is the most suitable type to validate. Essentially, these children should be three distinct sections. function Top ...

List the attributes that have different values

One of the functions I currently have incorporates lodash to compare two objects and determine if they are identical. private checkForChanges(): boolean { if (_.isEqual(this.definitionDetails, this.originalDetails) === true) { return false; ...

What reasons underlie the existence of various methods for importing Modules in JavaScript?

I'm confused about the distinctions when it comes to importing a JavaScript module in various ways such as: CommonJS ES5 ES6 NodeJS Typescript What is the reason for having multiple methods of importing JavaScript modules? Is the concept of a "modu ...

Invalid export field 'query' encountered while attempting to deploy NextJS13 and Sanity.io on Vercel

Currently, I am diving into the world of NextJS13 and following a blog tutorial by Sonny Sangha called 'Let’s build a BLOG with Next.js 13 (Sanity v3, TypeScript, Tailwind CSS, Auth, CMS, Preview Mode)'. After completing the tutorial, my goal i ...

Customize the border color of a dynamic textbox with Angular

I'm using Angular to create dynamic textboxes. <span *ngFor="let list of lists[0].question; let i = index"> {{ list }} <input type="text" *ngIf="i != lists[0].question.length-1" [(ngModel)] ...

What is the best method for connecting to the KONG API, hosted on an EC2 instance, from a separate EC2 instance running a Node.js application?

How can I make a call to the KONG API from my node.js application that is running on an EC2 instance? What steps do I need to take in order to establish communication between node.js and the KONG API? ...

How can one resolve the error message that says "WebDriverError: Connection refused"?

I am facing an issue with running Protractor tests on my local machine. A few days ago, everything was working fine but now I am unable to run the tests even after rebooting Ubuntu. Here are the versions of different components: $cat /etc/issue Ubuntu 14. ...

Mistakes that occur while trying to expand a base class to implement CRUD functionality

Creating a base class in TypeScript for a node.js application to be extended by all entities/objects for CRUD operations is my current challenge. The base class implementation looks like this: export class Base { Model: any; constructor(modelName ...

Adding a type declaration to the severity property in React Alert - A guide to Typescript

I've developed a type declaration object for the incoming data, but no matter what I try to define as the type for the property "severity", it's not happy. The options it wants (as displayed below) don't seem feasible. I'm curious if th ...

Exploring the directories: bundles, lib, lib-esm, and iife

As some libraries/frameworks prepare the application for publishing, they create a specific folder structure within the 'dist' directory including folders such as 'bundles', 'lib', 'lib-esm', and 'iife'. T ...

Typescript Declarations for OpenLayers version 6

The package @types/openlayers found at https://www.npmjs.com/package/@types/openlayers only provides type definitions for version 4.6 of OpenLayers. This is clearly stated in the top comment within the file index.d.ts. If types for OpenLayers 6 are not av ...

Angular fails to retrieve the data from an Object

I have both backend and frontend applications. When I attempt to retrieve information about the 'Probe' object, I can see its fields: https://i.stack.imgur.com/TJQqI.png However, when I try to access this information in Angular, I receive an und ...

parsing a TypeScript query

Is there a simpler way to convert a query string into an object while preserving the respective data types? Let me provide some context: I utilize a table from an external service that generates filters as I add them. The challenge arises when I need to en ...

The gulp-pug plugin is malfunctioning and displaying an error message stating "unexpected token 'indent'"

There seems to be an issue with gulp-pug indicating an unexpected token "indent" Please refer to the images below for further details: gulp code and nodejs command prompt index.pug and nodejs command prompt package.json and nodejs command prompt I am ...