0
昨天我擦干净了HD,并安装了Windows 10专业版。Angular 2'拒绝执行..'JSONP问题。
我安装了node/npm,git等,并且在Windows 8.1(工作)下正在运行的项目上运行“npm install”。
该项目依赖于连接到Behance.net API的服务。
当我键入“ng serve”时,控制台中出现错误。
Refused to execute script from 'http://www.behance.net/v2/users/dennisschafer/projects?api_key=myapikey&callback=__ng_jsonp__.__req0.finished' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.
EXCEPTION: Response with status: 200 Ok for URL: null
请注意,这个项目昨天在我的其他环境下工作,而且我从未触及任何代码。
这里的服务文件的样子:
import {Injectable} from '@angular/core';
import {Jsonp} from '@angular/http';
import 'rxjs/Rx';
@Injectable()
export class BehanceService{
private username:string = 'dennisschafer'; // dennisschafer
private api_key = 'myapikey';
constructor(private _jsonp: Jsonp) {
}
getProjects() {
return this._jsonp.get('http://www.behance.net/v2/users/'+this.username+'/projects?api_key='+this.api_key+'&callback=JSONP_CALLBACK')
.map(res => res.json());
}
}
啊,如果他们在我倒下的20个小时内从字面上改变了某些东西,从另一个操作系统升级,那真是疯了。 –
是的,昨晚它突然开始工作,它正在返回application/javascript。谢谢。 –