issue with angular and typescript

I'm currently working on developing an Angular 2 application that incorporates touch gestures using hammerjs. My goal is to merge the quickstarter application from: Angular 2 with the hammerjs application from: Hammerjs sample.

However, I keep encountering the following error:

http://localhost:3000/npm:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="72021e07151b1c5f060b02170111001b020632465c425c4342">[email protected]</a>/lib/plugin.js Failed to load resource: the server responded with a status of 404 (Not Found)
localhost/:33 Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:3000/npm:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3d4d51485a54531049444d584e5e4f544d497d09130d130c0d">[email protected]</a>/lib/plugin.js
Error: XHR error (404 Not Found) loading http://localhost:3000/npm:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="26564a53414f480b525f56435545544f565266120816081716">[email protected]</a>/lib/plugin.js
Error loading http://localhost:3000/npm:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5828342d3f3136752c21283d2b3b2a31282c186c7668766968">[email protected]</a>/lib/plugin.js
Unable to load transpiler to transpile http://localhost:3000/app/app.component.js
Error loading http://localhost:3000/app/app.component.js

Here is my systemjs.config.js file:

(function (global) {
  System.config({
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'ts',
typescriptOptions: {
  tsconfig: true
},
meta: {
  'typescript': {
    "exports": "ts"
  }
},
paths: {
  // paths serve as alias
  'npm:': 'node_modules'
},
// map tells the System loader where to look for things
map: {
  // our app is within the app folder
  app: 'app',

  // angular bundles
  '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
  '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
  '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
  '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
  '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
  '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
  '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
  '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
  '@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',

  // other libraries
  'rxjs':                       'npm:rxjs',
  'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',
  'ts':                         'npm:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="71...,

},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
  app: {
    main: './app.component.js',
    defaultExtension: 'js'
  },
  rxjs: {
    defaultExtension: 'js'
  },
  'angular2-in-memory-web-api': {
    main: './index.js',
    defaultExtension: 'js'
      }
    }
   });
})(this);

Below is my folder structure:

https://i.sstatic.net/2j2oo.jpg

And here is my package.json file:

{
  "name": "angular-quickstart",
  "version": "1.0.0",
  "description": "QuickStart package.json from the documentation, supplemented with testing support",
  "scripts": {
// list of scripts
  },
  "keywords": [],
  "author": "",
  "license": "MIT",
  "dependencies": {
    // list of dependencies
  },
  "devDependencies": {
    // list of dev dependencies
  },
  "repository": {}
}

I have already installed all the npm modules. What could be causing this issue?

Answer №1

Here is the essential information you may require (extracted from the guidelines for implementing TypeScript loader for SystemJS): In case you are utilizing SystemJS without JSPM (and you are using npm), ensure to include SystemJS map setup for plugin-typescript and typescript:

SystemJS.config({
  packages: {
    "ts": {
      "main": "plugin.js"
    },
    "typescript": {
      "main": "lib/typescript.js",
      "meta": {
        "lib/typescript.js": {
          "exports": "ts"
        }
      }
    }
  },
  map: {
    "ts": "path/to/plugin-typescript/lib",
    "typescript": "path/to/typescript"
  },
  transpiler: 'ts'
});

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

Access JSON value using jQuery by key

Creating a JSON structure that contains information about attendees: { "attendees": [ { "datum": "Tue, 11 Apr 2017 00:00:00 GMT", "name": " Muylaert-Geleir", "prename": "Alexander" }, { "datum": "Wed, 12 Apr 2017 ...

Adjust the size and color of text in Chart.js using Angular 5

Why does the font color in chartjs appear as light gray and not print when you want to do so from the page? I tried changing the font color of chartjs in the options attribute, but it didn't work. How can I change the font color in chartjs angular? ...

Converting MultiSelect Array from JavaScript to MySQL

I recently implemented a multiselect feature on the client side: <select name="country" data-placeholder="Choose a Country..." tabindex="2"> <option name="country" value="United States">United States</option> & ...

If a user is already logged in, AspNetBoilerplate (Free version + .NET Core + Angular) will redirect them to the home page from the login

How can we ensure users are redirected from the login page to the home page if they are already logged in? a) Currently, when a user is logged in and enters the URL "localhost:2222", they are automatically redirected to /app/home. b) However, if a user i ...

Is it possible to verify the user's authentication by confirming the presence of a JWT in their localStorage?

I am currently working on a project that requires JWT authentication. I have set up a registration form and login page where users receive an authorityToken and it is saved in localStorage. Once the user logs into their account : ` $("#btnLogin").click( ...

Managing Visual Studio Code Extension Intellisense: A Guide

I am looking to create an extension I recommend using "CompletionList" for users. Users can trigger completion by running "editor.action.triggerSuggest" The process of my extensions is as follows: Users input text If they press the "completion command," ...

React Native issue: why are my variables resetting mysteriously?

Hey there, I'm currently encountering a peculiar situation involving the usage of var and React.useState() variables. I am utilizing the library https://github.com/tongyy/react-native-draggable#readme to define 2 variables - var color1 = ''; ...

What is the best way to transform the date time format received from the server so that it can be used with the time-ago

Issue Explanation: My server is providing the date and time in a specific format as shown below - myDate2= '22-DEC-2017 03:22:11'; The current format does not work with time-ago-pipe and results in NaN Accepted Format: myDate: String = new Dat ...

Having trouble retrieving the Ionic 2 slides instance - getting a result of undefined

As I attempt to utilize the slides and access the instance in order to use the slideto functionality programmatically, I find myself encountering the issue of receiving 'undefined' back despite following the documentation. Here is my TypeScript ...

Structure of Sequelize calls

Recently, I've been working with sequelize and attempting to query my database with the code below: models.user.findOne({ where: {email: req.body.email} }, (err, existingUser) => { .... More code } Unfortunately, the code block isn't executi ...

Component remains populated even after values have been reset

My child component is structured as shown below, ChildComponent.html <div> <button type="button" data-toggle="dropdown" aria-haspopup="true" (click)="toggleDropdown()"> {{ selectedItemName }} <span></span> </but ...

Taking ASP.NET Core 2.0 with Angular to CloudFoundry

Currently, I am facing an issue while working on an app in CloudFoundry (CF). Whenever I push my code into CF, I encounter an error indicating that NodeJs is not installed. [APP/PROC/WEB/0] ERR [1] Ensure that Node.js is installed and can be found in one ...

Unraveling the Mystery of CSS3 or JavaScript Sliders

I am currently developing a new website and I was intrigued by the slider effect on Apple and IBM's websites. For reference, you can check out how it works on sites like: and I noticed that the text and images slide in opposite directions, which se ...

I am attempting to fetch the posts using an ajax call, however, I am encountering a server error 500 with Wordpress Ajax

After clicking on a pagination link (page number), the post_type, taxonomy, and term_name are retrieved. Using JQuery Variables, these variables are passed to an Ajax WordPress function. Although the Ajax function successfully receives the variables, the W ...

Upon successful completion of the Ajax call, refresh the page without causing any blinking

Hey there, I'm facing an issue with my website, I've implemented ajax to fetch data from my API, and upon successful retrieval, I need to reload the page to display the information, However, sometimes the page blinks before reloading, while oth ...

Utilizing Ajax: Sending Customized Data to a Modal

Having never worked with jquery before, I struggled to find a solution for my specific case. On the cockpit.php page, I have a form that retrieves content from a mysql database. Currently, I am able to display this content in a div on the same cockpit.php ...

What steps should I take to fix the issue of "[ERR_REQUIRE_ESM]: Must use import to load ES Module" while working with D3.js version 7.0.0 and Next.js version 11.0.1?

Encountered a roadblock while integrating D3 with Next.js - facing an error when using D3.js v7.0.0 with Next.js v11.0.1: [ERR_REQUIRE_ESM]: Must use import to load ES Module Tried utilizing next-transpile-modules without success Managed to make D3.js ...

What factors cause variations in script behavior related to the DOM across different browsers?

When looking at the code below, it's evident that its behavior can vary depending on the browser being used. It appears that there are instances where the DOM is not fully loaded despite using $(document).ready or similar checks. In Firefox, the "els ...

Pass a JavaScript variable to a PHP script using AJAX when a button is clicked, with a dynamically set href attribute

This is the current situation: There is a checkbox on each row of a table that represents some information An initially disabled button becomes enabled when any checkbox is checked The button is enclosed by an <a></a> tag as shown: <a>&l ...

Exploring the Benefits of Utilizing Cypress to Verify Form Fields and Manage Errors within Angular (version 13.3.0)

Recently started using Cypress with Angular version 13.3.0 and facing a validation issue with a form. Upon clicking a button, the form opens displaying various validation rules like 'First Name is required', 'Last Name', 'Gender&ap ...