The requested resource could not be located at @angular/platform-browser.js

I am attempting to set up ASP.NET MVC 5 (not Core) + Angular 2.0.0 + JSPM + SystemJS + TS Loader.

Upon running the application, I encounter the following error:

Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:59711/@angular/platform-browser.js

Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:59711/@angular/platform-browser.js(…)

The @angular packages are located in the jspm_packages/npm folder.

Currently, I am uncertain about the root cause of the issue - whether it's due to some breaking change in Angular or something related to SystemJS.

Below are my configuration files for reference:

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    /* target of the compilation (es5) */
    "module": "system",
    /* System.register([dependencies], function) (in JS)*/
    "moduleResolution": "node",
    /* how module gets resolved (needed for Angular 2)*/
    "emitDecoratorMetadata": true,
    /* needed for decorators */
    "experimentalDecorators": true,
    /* needed for decorators (@Injectable) */
    "noImplicitAny": false
    /* any has to be written explicity*/
  },
  "exclude": [
    /* since compiling these packages could take ages, we want to ignore them*/
    "jspm_packages",
    "node_modules"
  ],
  "compileOnSave": false
  /* on default the compiler will create js files */
}

config.js (jspm, configuration files is simplified)

System.config({
  baseURL: "/",
  defaultJSExtensions: true,
  transpiler: "babel",
  babelOptions: {
    "optional": [
      "runtime",
      "optimisation.modules.system"
    ]
  },
  typescriptOptions: {
    "tsconfig": true
  },
  paths: {
    "github:*": "jspm_packages/github/*",
    "npm:*": "jspm_packages/npm/*"
  },

  packages: {
    "app": {
      "main": "bootstrap",
      "format": "system",
      "defaultExtensions": "ts",
      "meta": {
        "*.ts": {
          "loader": "ts"
        }
      }
    }
  },

  map: {
    "@angular/common": "npm:@angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5734383a3a3839176579677967">[email protected]</a>",
    // Add more mapping entries here...
  }
});

index.html

<script>
    System.config
    ({
        transpiler: "ts",
        packages:
        {
            "app": {
                "defaultExtension": "ts",
            }
        }
    });

System.import('app/bootstrap').catch(console.log.bind(console));
</script>

Visual Studio raises issues concerning all angular imports.

bootstrap.js

import {bootstrap} from "@angular/platform-browser"
import {provide} from "@angular/core"

Answer №1

It appears that the package '@angular/platform-browser': 'npm:@angular/[email protected] is missing.

map: {
    "@angular/common": "npm:@angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6d0e02000002032d5f435d435d">[email protected]</a>",
    "@angular/compiler": "npm:@angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7d1e12100d1411180f3d4f534d534d">[email protected]</a>",
     ...
     ...
    '@angular/platform-browser': "npm:@angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="20504c4154464f524d0d42524f5753455260120e100e10">[email protected]</a>"
     ...
     ...
}

Furthermore, ensure to include it in your package.json if it's not already there.

"dependencies": {
    "@angular/common": "2.0.0",
    "@angular/compiler": "2.0.0",
     ...
     ...
    "@angular/platform-browser": "2.0.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

Dealing with Cross-Origin Resource Sharing problem in a React, TypeScript, Vite application with my .NET backend

I'm encountering a CORS issue when trying to make a Request using Fetch and Axios in my application hosted on the IIS Server. Here are my Server API settings: <httpProtocol> <customHeaders> <add name="Access-Control-Allow-O ...

The function signature '(newValue: DateRange<dateFns>) => void' does not match the expected type '(date: DateRange<unknown>, keyboardInputValue?: string | undefined) => void' as per TypeScript rules

I'm currently utilizing the MUI date range picker from https://mui.com/x/react-date-pickers/date-range-picker/. Here's my code snippet: <StaticDateRangePickerStyled displayStaticWrapperAs="desktop" value={valu ...

The modal remains closed: Error - Attempting to access property 'open' of undefined

I've been attempting to showcase a pop-up that I implemented as a modal, but I keep getting this error: TypeError: Cannot read property 'open' of undefined The pop-up was created as a component: import { Component, OnInit, ViewChild, Ele ...

Selecting an element in Angular2 that includes an ngIf directive

My example HTML code is below: <div id="foo" (mouseover)="blah()" *ngIf="isDisplayed"></div> Here is my JavaScript code: isDisplayed: boolean = false blah() { this.isDisplayed = true console.log(document.getElementById('foo')) ...

The variable being declared at the class level inside a function within the same class is not recognized

Seeking guidance on the code snippet I'm currently studying. I am implementing a TypeScript 1.8.10 compiler along with EM5: module myAmazingModule{ 'use strict'; export interface INavigateService { links: string[], ...

Uploading Multiple Files to a REST API Using Angular 6's Reactive Form

Looking to create a file uploader in Angular 6 using a reactive form. Once all files are selected, there will be an upload button to start uploading the files. The issue I'm facing is that I can't access all the files from the component without u ...

Guide on toggling mat-checkbox according to API feedback in Angular 6

Just starting out with angular 6 and I'm attempting to toggle the mat-checkbox based on the API response. However, I seem to be having trouble. All the checkboxes are showing as checked even when the API response is false. <div class="col-sm-12" ...

What steps can I take to fix the 'node module error' while deploying a project on Vercel?

While working with the world-countries package, I encountered an issue during deployment in Vercel. The error message indicated that a ';' was missing in the index.d.ts file of world-countries located in the node_module directory. Here is the ex ...

The setTimeout() function caught in an endless cycle

Is there a way to retrieve the height of divs used in multiple components? The HTML structure I am working with is as follows: <div #dataHeadlines *ngFor="let group of catt" [ngClass]='hf(dataHeadlines)'> <h4>{{ group }}< ...

How to extract a date from Mat-Datepicker without using moment library

I'm encountering an issue with Mat-datepicker in my Angular app. When I manually input the date into the field, it doesn't parse in the correct locale, but it displays correctly when selected from the month view. Recently, I made the switch from ...

How to toggle visibility of child elements in an HTML template using Angular 4+

I'm currently working on incorporating a basic "hover over a comment to display a reply button" feature in my angular application. Is it possible to create this effect using template reference variables exclusively? Something like this... <mat-l ...

Is it necessary to specify the inputs property when defining an Angular @Component?

While exploring the Angular Material Button code, I came across something interesting in the @Component section - a declared inputs property. The description indicates that this is a list of class property names to data-bind as component inputs. It seems ...

Having Trouble with Angular Form Reset and Receiving the Error Message "Trying to Reference a Destroyed View: detectChanges"

Upon successfully saving a value, I trigger a form reset. This involves calling a service method to send data to an API. this.customerService.saveSupplier({ customerId: Context.customerId, supplier: supplier }).subscribe(res => { this.pageReset(); ...

Effective strategies for extracting value from asynchronous Angular events that return Promises

When it comes to subscription blocks, extracting the value from my API is possible. var data = null; this._timinServiceProxy.getDateFromNTP().subscribe(result => { data = result; console.log(data); // The expected result }); console.log(data); ...

Arranging Angular Array-like Objects

I am in possession of an item: { "200737212": { "style": { "make": { "id": 200001510, "name": "Jeep", "niceName": "jeep" }, "model": { "id": "Jeep_Cherokee", "name": "Cherokee", "nice ...

Can the Angular Material Mat Stepper display multiple active/in-progress steps simultaneously?

Has anyone figured out how to display multiple steps simultaneously on Angular Mat Stepper? I've only been able to show one step at a time and haven't found a solution yet. Any insights would be greatly appreciated. https://i.stack.imgur.com/VK ...

Learning to utilize the i18n library with React Vite

The developer console is showing the following message: i18next::translator: missingKey en translation suche suche Here is the file structure of my project: vite.config.ts i18n.js test/ src/ components/InputSearch.tsx routes/ public/ de/translation. ...

Are the missing attributes the type of properties that are absent?

I have a pair of interfaces: meal-component.ts: export interface MealComponent { componentId: string; componentQuantity: number; } meal.ts: import { MealComponent } from 'src/app/interfaces/meal-component'; export interface Meal { ...

How to pass an array as parameters in an Angular HTTP GET request to an API

Hey there! I'm relatively new to Angular and I've hit a roadblock. I need to send an array as parameters to a backend API, which specifically expects an array of strings. const params = new HttpParams(); const depKey = ['deploymentInprogre ...

Issues with TypeScript Optional Parameters functionality

I am struggling with a situation involving the SampleData class and its default property prop2. class SampleData { prop1: string; prop2: {} = {}; } export default SampleData; Every time I attempt to create a new instance of SampleData without sp ...