electron / electron-api-demos

Explore the Electron APIs
http://electronjs.org/#get-started
MIT License
10.25k stars 2.12k forks source link

Uncaught TypeError: Cannot read property 'querySelector' of undefined #508

Open joaodematejr opened 2 years ago

joaodematejr commented 2 years ago

Array.prototype.forEach.call(links, (link) => { let template = link.import.querySelector('.task-template') let clone = document.importNode(template.content, true) if (link.href.match('about.html')) { document.querySelector('body').appendChild(clone) } else { document.querySelector('.content').appendChild(clone) } })

gzx-miller commented 2 years ago

Same problem at win 10, and linux manjaro.

ViktorFilonenko commented 2 years ago

Hi, Same issue for Mac and I think for everybody who have updated their Chrome https://www.chromestatus.com/feature/5144752345317376

Only way is to get rid of rel="import" in favour of other loading mechanism.

Env was: Node.js 16.5.0, Chromium 94.0.4606.81, and Electron 15.3.1

lichong-a commented 2 years ago

same problem at win11,node16.5.0

LeiMingZ commented 2 years ago

some issue: Uncaught TypeError: Cannot read property 'querySelector' of undefined、、、、 For me, a novice, I look confused。

wangjianxiang commented 2 years ago

Uncaught TypeError: Cannot read property 'app' of undefined at Settings._getSettingsFilePath (D:\projects\source-code\webStorm\electron\electron-api-demos\node_modules\electron-settings\lib\settings.js:75) at Settings._ensureSettings (D:\projects\source-code\webStorm\electron\electron-api-demos\node_modules\electron-settings\lib\settings.js:147) at Settings._readSettings (D:\projects\source-code\webStorm\electron\electron-api-demos\node_modules\electron-settings\lib\settings.js:192)

I have the same problem

coofive commented 2 years ago

image

I have the same problem at win10, node 14.15.1, npm 6.14.8

miki-long commented 2 years ago

[Mickey]已经收到了,谢谢

youyou12344 commented 2 years ago

因为 electron 版本太高,对应的 chromium 版本不支持 html imports。 解决方法: 在 package.json 中降低 electron 的版本为 ^7.2.4。 package-lock.json 中删除 "electron"。

Because the electron version is too high, the corresponding chromium version does not support 'HTML imports'. Solution:
The version of electron in package.json is reduced to ^ 7.2 4。 delete "electron" in package-lock.json。

Always-beginner commented 2 years ago

That's working for me thank you!!

first, delete electron js from node_module then reduce your package JSON version to ^7.2.4 after re-download this version of electron and it's working fine.! thank you @youyou12344