Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一直提示Cannot read property 'newPage' of null" #20

Open
dawang0123 opened this issue Jul 27, 2018 · 10 comments
Open

一直提示Cannot read property 'newPage' of null" #20

dawang0123 opened this issue Jul 27, 2018 · 10 comments

Comments

@dawang0123
Copy link

Uploading image.png…

@dawang0123
Copy link
Author

Your application is running here: http://localhost:8587
[12:18:01] ℹ 「pswp」: begin to generator skeleton screen
[12:18:01] ⚠ 「pswp」: TypeError: Cannot read property 'newPage' of null
at Skeleton.newPage (/Users/wangqian/Documents/work/task/ztjy_task_medal/node_modules/page-skeleton-webpack-plugin/src/skeleton.js:34:37)
at Skeleton.genHtml (/Users/wangqian/Documents/work/task/ztjy_task_medal/node_modules/page-skeleton-webpack-plugin/src/skeleton.js:64:29)
at Promise.all.routes.map (/Users/wangqian/Documents/work/task/ztjy_task_medal/node_modules/page-skeleton-webpack-plugin/src/skeleton.js:244:19)
at Array.map ()
at Skeleton.renderRoutes (/Users/wangqian/Documents/work/task/ztjy_task_medal/node_modules/page-skeleton-webpack-plugin/src/skeleton.js:242:31)
at SockJSConnection. (/Users/wangqian/Documents/work/task/ztjy_task_medal/node_modules/page-skeleton-webpack-plugin/src/server.js:144:57)
at emitOne (events.js:116:13)
at SockJSConnection.emit (events.js:211:7)
at Session.didMessage (/Users/wangqian/Documents/work/task/ztjy_task_medal/node_modules/sockjs/lib/transport.js:246:25)
at WebSocketReceiver.didMessage (/Users/wangqian/Documents/work/task/ztjy_task_medal/node_modules/sockjs/lib/trans-websocket.js:104:39)
at WebSocket. (/Users/wangqian/Documents/work/task/ztjy_task_medal/node_modules/sockjs/lib/trans-websocket.js:70:24)
at emitOne (events.js:116:13)
at WebSocket.emit (events.js:211:7)
at WebSocket.dispatchEvent (/Users/wangqian/Documents/work/task/ztjy_task_medal/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:24:10)
at WebSocket._receiveMessage (/Users/wangqian/Documents/work/task/ztjy_task_medal/node_modules/faye-websocket/lib/faye/websocket/api.js:142:10)
at Hybi. (/Users/wangqian/Documents/work/task/ztjy_task_medal/node_modules/faye-websocket/lib/faye/websocket/api.js:34:49)

@jayZOU
Copy link

jayZOU commented Aug 2, 2018

@dawang0123
npm install puppeteer 的时候会默认下载一个Chromium ,你应该是这步出错,实际上可以直接运行本地下载好的chrome,没必要再去下载一个

//node_modules\page-skeleton-webpack-plugin\src\skeleton.js
//26行
this.browser = await puppeteer.launch({ headless })
//改成
this.browser = await puppeteer.launch({ headless, executablePath: 'you/chrome/path/chrome.exe' })

@czlin
Copy link

czlin commented Aug 29, 2018

@jayZOU
image

还是会报Cannot read property 'newPage' of null

@Jmingzi
Copy link

Jmingzi commented Sep 18, 2018

我也遇到了同样的问题,改了也没用。

image

@haruhihi
Copy link

同样的问题
在 examples/sale 下 npm run defv

@Jmingzi
Copy link

Jmingzi commented Sep 18, 2018

@haruhihi 确实是chromeium未下载成功的问题,改用4G下载后解决。

@jayZOU
Copy link

jayZOU commented Sep 18, 2018

set PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1&&npm install puppeteer
可以用缺省的方式去安装puppeteer,这样就不会下载chromeium了,可以后面自己指定本地chrome路径

@dblate
Copy link

dblate commented Sep 20, 2018

多执行几次 npm install puppeteer 直到成功
如果有可用的镜像仓库,可以加上以提升网络访问成功率,比如 npm install puppeteer --registry=http://registry.npm.baidu.com

@huzewei
Copy link

huzewei commented May 23, 2019

我也遇到这个问题。log后发现 this.browser = await puppeteer.launch({ headless }) 一直是null.多执行几次 npm install puppeteer(registry淘宝镜像) 直到成功。会有一个安装chromeium的过程。最后解决了问题。但是最后生成的样式有问题

@yangfan-coder
Copy link

cnpm install puppeteer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants