external "require('url')":1 Uncaught ReferenceError: require is not defined
See original GitHub issue@maximegris
When i run npm run start:web
to serve the app from the browser i am getting following error.
It looks like chrome does not know how to interpret require('url')
which is node module. the only place i can find this import is in webpack externals. Can you please point me into right direction?
external "require('url')":1 Uncaught ReferenceError: require is not defined
at Object.<anonymous> (external "require('url')":1)
at __webpack_require__ (bootstrap 151bbb78dee4aab80101:54)
at Object.<anonymous> (client:2)
at Object.<anonymous> (client?ffdb:204)
at __webpack_require__ (bootstrap 151bbb78dee4aab80101:54)
at Object.<anonymous> (polyfills.bundle.js:5881)
at __webpack_require__ (bootstrap 151bbb78dee4aab80101:54)
at webpackJsonpCallback (bootstrap 151bbb78dee4aab80101:25)
at polyfills.bundle.js:1
14:57:33.753 core.es5.js:350 Uncaught reflect-metadata shim is required when using class decorators
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:22 (5 by maintainers)
Top Results From Across the Web
Once I set nodeIntegration:false -> "Uncaught ReferenceError ...
Once I set nodeIntegration:false -> "Uncaught ReferenceError: require is not defined at Object.url (external "url":1) " #electron-#react-# ...
Read more >ReferenceError: require is not defined in JavaScript - Stack Diary
The "ReferenceError: require is not defined" error occurs when the require function is used in a JavaScript file that is intended to be ......
Read more >How To Fix ReferenceError require is not defined in JavaScript
The Solution. Your ReferenceError: require is not defined likely has one of two causes: You tried using require in a browser environment ......
Read more >How to fix the error `require is not defined` in Node.js
Today I started writing a new project on Node.js and got this error on the very first run: const express = require('express'); ...
Read more >Once I set nodeIntegration: false, I get this error: external "url"
external "url":1 Uncaught ReferenceError: require is not defined at Object.url (external "url":1) at __webpack_require__ (bootstrap:789) at fn ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had this problem happen recently when upgrading from Electron 4 to Electron 5.
Solution: https://stackoverflow.com/questions/55093700/electron-5-0-0-uncaught-referenceerror-require-is-not-defined
Setting
nodeIntegration
totrue
may fix your upgrade from Electron 4 to 5:@maximegris Great project. Thank you. This is my 3rd project with it.
I just cloned
angular-electron
to start a new project (3rd). The same error with require came up withnpm start
for onlyhttp://localhost:4200/
(as in my 2nd project which I never spent time to figure out. Now I did).npm start
invokes both web & electron app. Which is the ideal scenario.Also, running
ng:serve
produces the require error for onlyhttp://localhost:4200/
.The solution:
ng:serve
ng:serve:web
or change
npm start
to:"start": "npm-run-all -p ng:serve:web electron:serve"
I suggest removing reference to
ng:serve
.