404 未找到@angular/platform-browser.js
404 Not Found @angular/platform-browser.js
我尝试设置 ASP.NET MVC 5
(不是核心)+ Angular 2.0.0 + JSPM + SystemJS + TS Loader。
当我 运行 应用时出现错误:
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(…)
@angular 包在文件夹 jspm_packeges/npm 中。
现在我真的不知道问题的根源是什么 Angular 或 SystemJS 中的某些重大更改。
这是我的配置文件:
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,配置文件已简化)
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/common@2.0.0",
"@angular/compiler": "npm:@angular/compiler@2.0.0",
"@angular/core": "npm:@angular/core@2.0.0",
"@angular/http": "npm:@angular/http@2.0.0",
"@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@2.0.0",
"@angular/router": "npm:@angular/router@3.0.0",
"babel": "npm:babel-core@5.8.38",
"babel-runtime": "npm:babel-runtime@5.8.38",
"core-js": "npm:core-js@1.2.7",
"reflect-metadata": "npm:reflect-metadata@0.1.8",
"rxjs": "npm:rxjs@5.0.0-beta.12",
"ts": "github:frankwallis/plugin-typescript@5.1.2",
"zone.js": "npm:zone.js@0.6.23",
"github:frankwallis/plugin-typescript@5.1.2": {
"typescript": "npm:typescript@2.0.2"
//...
}
});
index.html
<script>
System.config
({
transpiler: "ts",
packages:
{
"app": {
"defaultExtension": "ts",
}
}
});
System.import('app/bootstrap').catch(console.log.bind(console));
</script>
Visual Studio 抱怨所有 angular 导入。
bootstrap.js
import {bootstrap} from "@angular/platform-browser"
import {provide} from "@angular/core"
似乎:'@angular/platform-browser': 'npm:@angular/platform-browser@2.0.0 包丢失。
map: {
"@angular/common": "npm:@angular/common@2.0.0",
"@angular/compiler": "npm:@angular/compiler@2.0.0",
...
...
'@angular/platform-browser': "npm:@angular/platform-browser@2.0.0"
...
...
}
注意:也将其添加到 package.json 如果还没有,
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
...
...
"@angular/platform-browser": "2.0.0",
...
}
我尝试设置 ASP.NET MVC 5
(不是核心)+ Angular 2.0.0 + JSPM + SystemJS + TS Loader。
当我 运行 应用时出现错误:
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(…)
@angular 包在文件夹 jspm_packeges/npm 中。
现在我真的不知道问题的根源是什么 Angular 或 SystemJS 中的某些重大更改。
这是我的配置文件:
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,配置文件已简化)
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/common@2.0.0",
"@angular/compiler": "npm:@angular/compiler@2.0.0",
"@angular/core": "npm:@angular/core@2.0.0",
"@angular/http": "npm:@angular/http@2.0.0",
"@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@2.0.0",
"@angular/router": "npm:@angular/router@3.0.0",
"babel": "npm:babel-core@5.8.38",
"babel-runtime": "npm:babel-runtime@5.8.38",
"core-js": "npm:core-js@1.2.7",
"reflect-metadata": "npm:reflect-metadata@0.1.8",
"rxjs": "npm:rxjs@5.0.0-beta.12",
"ts": "github:frankwallis/plugin-typescript@5.1.2",
"zone.js": "npm:zone.js@0.6.23",
"github:frankwallis/plugin-typescript@5.1.2": {
"typescript": "npm:typescript@2.0.2"
//...
}
});
index.html
<script>
System.config
({
transpiler: "ts",
packages:
{
"app": {
"defaultExtension": "ts",
}
}
});
System.import('app/bootstrap').catch(console.log.bind(console));
</script>
Visual Studio 抱怨所有 angular 导入。
bootstrap.js
import {bootstrap} from "@angular/platform-browser"
import {provide} from "@angular/core"
似乎:'@angular/platform-browser': 'npm:@angular/platform-browser@2.0.0 包丢失。
map: {
"@angular/common": "npm:@angular/common@2.0.0",
"@angular/compiler": "npm:@angular/compiler@2.0.0",
...
...
'@angular/platform-browser': "npm:@angular/platform-browser@2.0.0"
...
...
}
注意:也将其添加到 package.json 如果还没有,
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
...
...
"@angular/platform-browser": "2.0.0",
...
}