2017-03-28 5 views
16

मैं कोणीय 2 रूटिंग और नेविगेशन उदाहरण का पालन कर रहा हूं जो इस लिंक पर पाया जा सकता है: https://plnkr.co/edit/I4ArEQTniO7MJtfzpBWl?p=infoऑगुलर 2 राउटर एनीमेशन - मॉड्यूल '@ कोणीय/प्लेटफ़ॉर्म-ब्राउज़र/एनिमेशन' नहीं मिल सकता

जब मैं ट्रांसलेटर चलाता हूं तो मुझे त्रुटि संदेश मिलता है: "क्लाइंट/ऐप/app.module.ts (5,41): त्रुटि टीएस 2307: मॉड्यूल '@ कोणीय/प्लेटफ़ॉर्म-ब्राउज़र/एनिमेशन' नहीं मिल सकता है।"

मेरे systemjs.config.js (नीचे दिखाया गया) के आधार पर, मैं मॉड्यूल '@ कोणीय/प्लेटफ़ॉर्म-ब्राउज़र/एनिमेशन' फ़ाइल होने के लिए अपेक्षा करता हूं, "प्लेटफ़ॉर्म-ब्राउज़र-एनिमेशन -umd.js" में स्थित है node_modules/@ कोणीय/मंच-ब्राउज़र/बंडल, लेकिन यह वहां नहीं है।

//systemjs.config.js 
(function (global) { 
    System.config({ 
    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/animations': 'npm:@angular/animations/bundles/animations.umd.js', 
    '@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js', 
    '@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/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.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/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js', 
    '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', 
    '@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js', 
    '@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js', 

    // other libraries 
    'rxjs':      'npm:rxjs', 
    'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js' 
}, 
// packages tells the System loader how to load when no filename and/or no extension 
packages: { 
    //app: { 
    // main: './main.js', 
    // defaultExtension: 'js' 
    //}, 
    client: { 
    main: './main.js', 
    defaultExtension: 'js' 
    }, 
    rxjs: { 
    defaultExtension: 'js' 
    } 
} 
}); 
})(this); 

NPM मैं स्थापित करने की कोशिश की का उपयोग करते हुए याद आ रही व्यवस्थाएं स्थापित लेकिन एक unmet की निर्भरता त्रुटि संदेश मिलता है:

+-- UNMET PEER DEPENDENCY @angular/[email protected] 
+-- UNMET PEER DEPENDENCY @angular/[email protected] 
`-- UNMET PEER DEPENDENCY @angular/[email protected] 

मैं तो निर्भर संस्करणों को स्थापित करने की कोशिश की लेकिन unmet की निर्भरता संदेश प्राप्त करना जारी रखा।

>npm install @angular/[email protected] @angular/[email protected] @angular/[email protected] --save 

मैं एक चेतावनी इंगित करता है कि मैं कोणीय 4.

npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but no 
ne was installed. 

ऐसा लगता है कि स्थापित करना चाहिए जैसे मैं एनिमेशन 4.0 स्थापित किया है और यह मूल 4.0 जो मैं स्थापित करने के लिए नहीं करना चाहते हैं की आवश्यकता है देखा। क्या मुझे एनिमेशन 4.0 को अनइंस्टॉल करने और एनिमेशन के पुराने संस्करण को स्थापित करने की आवश्यकता है? मेरी पैकेज.जेसन फ़ाइल नीचे है।

//package.json 
{ 
"name": "angular-quickstart", 
"version": "1.0.0", 
"description": "QuickStart package.json from the documentation, supplemented with testing support", 
"scripts": { 
"build": "tsc -p client/", 
"build:watch": "tsc -p client/ -w", 
"build:e2e": "tsc -p e2e/", 
"serve:e2e": "lite-server -c=bs-config.e2e.json", 
"prestart": "npm run build", 
"start": "npm run build:watch", 
"pree2e": "npm run build:e2e", 
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first", 
"preprotractor": "webdriver-manager update", 
"protractor": "protractor protractor.config.js", 
"pretest": "npm run build", 
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"", 
"pretest:once": "npm run build", 
"test:once": "karma start karma.conf.js --single-run", 
"lint": "tslint ./client/**/*.ts -t verbose" 
    }, 
"keywords": [], 
"author": "", 
"license": "MIT", 
"dependencies": { 
"@angular/animations": "^4.0.0", 
"@angular/common": "^2.4.8", 
"@angular/compiler": "~2.4.0", 
"@angular/core": "^2.4.8", 
"@angular/forms": "~2.4.0", 
"@angular/http": "~2.4.0", 
"@angular/platform-browser": "^2.4.10", 
"@angular/platform-browser-dynamic": "~2.4.0", 
"@angular/router": "~3.4.0", 
"angular-animate": "^1.6.3", 
"angular-in-memory-web-api": "~0.2.4", 
"body-parser": "^1.17.0", 
"bootstrap": "^3.3.7", 
"cookie-parser": "^1.4.3", 
"core-js": "^2.4.1", 
"ejs": "^2.5.6", 
"express": "^4.15.0", 
"express-session": "^1.15.1", 
"jade": "^1.11.0", 
"jquery": "^3.1.1", 
"mongoose": "^4.8.5", 
"morgan": "^1.8.1", 
"passport": "^0.3.2", 
"passport-local": "^1.0.0", 
"rxjs": "5.0.1", 
"stylus": "^0.54.5", 
"systemjs": "0.19.40", 
"toastr": "^2.1.2", 
"zone.js": "^0.7.4" 
}, 
"devDependencies": { 
"concurrently": "^3.2.0", 
"lite-server": "^2.2.2", 
"typescript": "~2.0.10", 
"canonical-path": "0.0.2", 
"tslint": "^3.15.1", 
"lodash": "^4.16.4", 
"jasmine-core": "~2.4.1", 
"karma": "^1.3.0", 
"karma-chrome-launcher": "^2.0.0", 
"karma-cli": "^1.0.1", 
"karma-jasmine": "^1.0.2", 
"karma-jasmine-html-reporter": "^0.2.2", 
"protractor": "~4.0.14", 
"rimraf": "^2.5.4", 
"@types/node": "^6.0.46", 
"@types/jasmine": "2.5.36" 
}, 
"repository": {} 
} 

ऐसा लगता है कि समस्या मेरे एनिमेशन संस्करण से संबंधित हो सकती है? यदि आप सहमत हैं, मौजूदा संस्करण को अनइंस्टॉल कैसे करें और मुझे कौन सा संस्करण इंस्टॉल करना चाहिए जो @ कोणीय/कोर I के संस्करण के साथ संगत है, 2.4.8 है। यदि यह समस्या नहीं है, तो मैं लापता फ़ाइल, @ कोणीय/प्लेटफ़ॉर्म-ब्राउज़र/बंडल/प्लेटफ़ॉर्म-ब्राउज़र-animations.umd.js कैसे इंस्टॉल करूं?

उत्तर

28

घंटों के लिए शोध करने के बाद मुझे @ कोणीय/एनिमेशन का कोई संस्करण नहीं मिला जो @ कोणीय/कोर के मेरे संस्करण (ओं) के साथ संगत था जो 2.4.0-2.4.8 से था। मैंने इस पोस्ट का जवाब पढ़ा, How to get list of versions for compatible Angular 2 modules?। इस पोस्ट से संकेत मिलता है कि राउटर को छोड़कर कोणीय 2 के सभी मॉड्यूल एक ही संस्करण में हैं इसलिए मैंने अपने पैकेज.जेसन में @ कोणीय/एनिमेशन 2.4.8 को प्लग किया और एनिमेशन को एंट्रीज़ एंट्री सहित 2.4.8 में बदल दिया क्योंकि मैं निश्चित होना चाहता था मैं कुछ याद नहीं कर रहा था। मैं फिर एनपीएम स्थापित चला गया और यह एनिमेशन संस्करण पर असफल रहा।

मुझे अंत में यह पोस्ट मिला; कोणीय 4.0 को अद्यतन करने पर http://angularjs.blogspot.com/। पोस्ट में एनीमेशन मॉड्यूल का एक विशिष्ट उल्लेख भी था जो मुझे याद आ रहा है लेकिन केवल अपग्रेड के साथ उपलब्ध है। मैंने विंडोज़ के लिए सरल अपडेट निर्देशों का पालन किया और मेरा आवेदन अब ठीक चल रहा है। मेरा ऐप गाइड से प्लंकर उदाहरण के समान है। पोस्ट के अनुसार, यदि आप कोणीय 2.x.x चला रहे हैं तो यह अधिकांश अनुप्रयोगों के लिए पिछड़ा होना चाहिए। नीचे अपग्रेड निर्देश हैं।

4.0.0

अद्यतन कर रहा से 4 करने के लिए अद्यतन कर रहा है नवीनतम संस्करण, और दोहरी जांच करता है, तो आप एनिमेशन चाहते करने के लिए अपने कोणीय निर्भरता को अद्यतन करने के रूप में के रूप में आसान है। यह ज्यादातर उपयोग मामलों के लिए काम करेगा।

पर लिनक्स/मैक:

NPM स्थापित @ कोणीय/{आम, संकलक, संकलक CLI, कोर, रूपों, http, मंच ब्राउज़र, मंच ब्राउज़र-गतिशील, मंच-सर्वर, रूटर, एनिमेशन } @latest टाइपप्रति @ नवीनतम --save

विंडोज पर:

NPM स्थापित @ कोणीय/आम @ नवीनतम @ कोणीय/संकलक @ नवीनतम @ कोणीय/संकलक-CLI @ नवीनतम @ कोणीय/कोर @ नवीनतम @angular/नवीनतम @ कोणीय/http @ नवीनतम @ कोणीय/प्लेटफ़ॉर्म-ब्राउज़र @ नवीनतम @ कोणीय/प्लेटफ़ॉर्म-ब्राउज़र-गतिशील @ नवीनतम @ कोणीय/प्लेटफ़ॉर्म-सर्वर @ नवीनतम @ कोणीय/राउटर @ नवीनतम @ कोणीय/एनिमेशन @ नवीनतम टी ypescript @ नवीनतम --save

+2

बढ़िया, अनुवर्ती @ j-Terranova! – Geoffrey

+1

महान उत्तर - पूरी तरह से काम किया और मुझे इस समस्या पर अनगिनत घंटे जलाने से रोक दिया। – Shane

+1

यह मुझे लंबे समय से परेशान कर रहा है। यह समाधान सही है! –

2

नीचे की कोशिश करो कदम

चरण-1

$ rm- आरएफ node_modules

$ NPM कैश स्पष्ट

चरण -2

$ NPM/एनिमेशन स्थापित @ कोणीय @ नवीनतम --save

$ NPM स्थापित

इसका मेरे लिए काम किया

+0

'npm' के सबसे पुराने संस्करण में 'npm कैश साफ़' आदेश अब उपलब्ध नहीं है। यदि अब आपको वास्तव में कैश साफ़ करने की आवश्यकता है तो आपके पास अब 'npm कैश सत्यापित करें' है: 'npm कैश साफ़ --force' –

संबंधित मुद्दे