无法在angular mobile中读取未定义的属性'makeCurrent'

时间:2022-08-24 13:21:16

I've done according to angular mobile, https://github.com/angular/mobile-toolkit/blob/master/guides/cli-setup.md

我根据角度移动完成了,https://github.com/angular/mobile-toolkit/blob/master/guides/cli-setup.md

Node version v4.4.3 NPM version 2.15.1

节点版本v4.4.3 NPM版本2.15.1

Problem is when I type $ ng serve encounter following error.

问题是我输入$ ng服务遇到以下错误。

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)

2 个解决方案

#1


7  

Ok finally got it working. Update package.json in your root folder like below

好吧终于搞定了。像下面一样更新根文件夹中的package.json

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

Also add

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

then

> npm update

This will make it working again

这将使它再次运作

#2


1  

I was able to get it working by just updating the two packages mentioned by Aswin.

我只是通过更新Aswin提到的两个软件包就能让它工作。

The latest/working versions at the time were:

当时的最新/工作版本是:

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

#1


7  

Ok finally got it working. Update package.json in your root folder like below

好吧终于搞定了。像下面一样更新根文件夹中的package.json

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

Also add

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

then

> npm update

This will make it working again

这将使它再次运作

#2


1  

I was able to get it working by just updating the two packages mentioned by Aswin.

我只是通过更新Aswin提到的两个软件包就能让它工作。

The latest/working versions at the time were:

当时的最新/工作版本是:

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