Angular with Universal does not run
I am a beginner in angular 4. I need angular app with SEO friendly.It supports Angular Universal (with --universal flag after ung new or ung init),
I've created an angular Universal app.
I tried to this way.
npm install -g universal-cli
ung new PROJECT_NAME
cd PROJECT_NAME
ung serve
I ran the project I got this error
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
** Universal-cli Development Server is running on http://localhost:4200. **
Hash: 34da1f0a10666443edabf3e29a861661ab204818
webpack: bundle is now VALID
module.js:471
throw err;
^
Error: Cannot find module 'F:anithaprojectsAngular universalTestProject"F:anithaprojectsAngular'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:390:7)
at startup (bootstrap_node.js:150:9)
at bootstrap_node.js:505:3
I tried to remove node_modules again i install npm.But Still not working. Here is my package.json
{
"name": "demo",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ung serve",
"lint": "tslint "src/**/*.ts"",
"test": "ung test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.2.3",
"@angular/compiler": "2.2.3",
"@angular/core": "2.2.3",
"@angular/forms": "2.2.3",
"@angular/http": "2.2.3",
"@angular/platform-browser": "2.2.3",
"@angular/platform-browser-dynamic": "2.2.3",
"@angular/router": "3.2.3",
"@angular/platform-server": "2.2.3",
"angular2-platform-node": "2.1.0-rc.1",
"angular2-universal": "2.1.0-rc.1",
"angular2-universal-polyfills": "2.1.0-rc.1",
"angular2-express-engine": "2.1.0-rc.1",
"compression": "1.6.2",
"express": "^4.14.0",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@angular/compiler-cli": "2.2.3",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"@types/body-parser": "0.0.29",
"@types/compression": "0.0.29",
"@types/cookie-parser": "^1.3.29",
"@types/express": "^4.0.29",
"@types/express-serve-static-core": "^4.0.29",
"@types/mime": "0.0.28",
"@types/serve-static": "^1.7.27",
"universal-cli": "1.0.0-alpha.universal.3",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "~4.0.13",
"ts-node": "1.2.1",
"tslint": "^4.0.2",
"typescript": "~2.0.3"
}
}
How can i fix this issue.
The universal-cli is outdated. Notice how the packages use Angular 2. Follow this guide and use angular-cli instead.
链接地址: http://www.djcxy.com/p/31300.html上一篇: Angular Universal Reload两次
下一篇: 角度与通用不运行