jquery 无法使用

来源:2-5 开发准备

webJ

2017-04-23


Failed to compile.  D:/WWW/angular/auction/src/app/app.component.ts (12,5): Cannot find name '$'.

package.json

{
 "name": "auction",
 "version": "0.0.0",
 "license": "MIT",
 "scripts": {
   "ng": "ng",
   "start": "ng serve",
   "build": "ng build",
   "test": "ng test",
   "lint": "ng lint",
   "e2e": "ng e2e"
 },
 "private": true,
 "dependencies": {
   "@angular/common": "^4.0.0",
   "@angular/compiler": "^4.0.0",
   "@angular/core": "^4.0.0",
   "@angular/forms": "^4.0.0",
   "@angular/http": "^4.0.0",
   "@angular/platform-browser": "^4.0.0",
   "@angular/platform-browser-dynamic": "^4.0.0",
   "@angular/router": "^4.0.0",
   "bootstrap": "^3.3.7",
   "core-js": "^2.4.1",
   "jquery": "^3.2.1",
   "rxjs": "^5.1.0",
   "zone.js": "^0.8.4"
 },
 "devDependencies": {
   "@angular/cli": "1.0.0",
   "@angular/compiler-cli": "^4.0.0",
   "@types/bootstrap": "^3.3.33",
   "@types/jasmine": "2.5.38",
   "@types/jquery": "^2.0.41",
   "@types/node": "~6.0.60",
   "codelyzer": "~2.0.0",
   "jasmine-core": "~2.5.2",
   "jasmine-spec-reporter": "~3.2.0",
   "karma": "~1.4.1",
   "karma-chrome-launcher": "~2.0.0",
   "karma-cli": "~1.0.1",
   "karma-coverage-istanbul-reporter": "^0.2.0",
   "karma-jasmine": "~1.1.0",
   "karma-jasmine-html-reporter": "^0.2.2",
   "protractor": "~5.1.0",
   "ts-node": "~2.0.0",
   "tslint": "~4.5.0",
   "typescript": "~2.2.0"
 }
}


angular-cli.json


{
 "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
 "project": {
   "name": "auction"
 },
 "apps": [
   {
     "root": "src",
     "outDir": "dist",
     "assets": [
       "assets",
       "favicon.ico"
     ],
     "index": "index.html",
     "main": "main.ts",
     "polyfills": "polyfills.ts",
     "test": "test.ts",
     "tsconfig": "tsconfig.app.json",
     "testTsconfig": "tsconfig.spec.json",
     "prefix": "app",
     "styles": [
       "styles.css",
       "../node_modules/bootstrap/dist/css/bootstrap.css"
     ],
     "scripts": [
       "../node_modules/jquery/dist/jquery.js",
       "../node_modules/bootstrap/dist/js/bootstrap.js"
     ],
     "environmentSource": "environments/environment.ts",
     "environments": {
       "dev": "environments/environment.ts",
       "prod": "environments/environment.prod.ts"
     }
   }
 ],
 "e2e": {
   "protractor": {
     "config": "./protractor.conf.js"
   }
 },
 "lint": [
   {
     "project": "src/tsconfig.app.json"
   },
   {
     "project": "src/tsconfig.spec.json"
   },
   {
     "project": "e2e/tsconfig.e2e.json"
   }
 ],
 "test": {
   "karma": {
     "config": "./karma.conf.js"
   }
 },
 "defaults": {
   "styleExt": "css",
   "component": {}
 }
}



为什么会报错呢,npm 安装 也是成功的 

写回答

1回答

JoJo

2017-04-24

报什么错,把错误信息贴出来我看一下。

0
1
webJ
Failed to compile. D:/WWW/angular/auction/src/app/app.component.ts (12,5): Cannot find name '$'.
2017-04-25
共1条回复

Angular4.0从入门到实战 打造股票管理网站

Angular新特性,教你熟练使用 Angular 和 Typescript 开发组件式单页应用

2683 学习 · 1361 问题

查看课程