不能读取property '在角度移动中未定义的

Cannot read property 'makeCurrent' of undefined in angular mobile

本文关键字:移动 未定义 读取 不能读 property 不能      更新时间:2023-09-26

我已经按照angular mobile做了,https://github.com/angular/mobile-toolkit/blob/master/guides/cli-setup.md

节点版本v4.4.3NPM版本2.15.1

问题是当我输入$ ng serve时遇到以下错误。

Cannot read property 'makeCurrent' of undefined
TypeError: Cannot read property 'makeCurrent' of undefined
    at Object.<anonymous> (/Users/user/Documents/Projects/PWA/hello-mobile/node_modules/angular2-universal/dist/node/node.js:7:35)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/user/Documents/Projects/PWA/hello-mobile/node_modules/angular2-universal/dist/node/index.js:5:17)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/user/Documents/Projects/PWA/hello-mobile/node_modules/angular2-broccoli-prerender/dist/prerender.js:8:28)
    at Module._compile (module.js:409:26)

好了,终于修好了。更新包。在根目录下的Json文件

"angular2-broccoli-prerender": "0.11.3",
"angular2-universal": "0.104.4",

添加

"child-process-promise": "^2.0.2",
"optimist": "^0.6.1"
然后

> npm update

这将使它再次工作

我能够通过更新Aswin提到的两个包来使它工作。

当时最新的/可用的版本是:

"angular2-broccoli-prerender": "0.11.5",
"angular2-universal":"0.104.5",