vite: Uncaught (in promise) TypeError: crypto.randomBytes is not a function - vue.js

How the problem arises:
Access to vite in the project, an error is reported when running vite
Error corresponding file:
return crypto.randomBytes(Math.ceil(len / 2)).toString('hex').slice(0, len); //This line reports an error in /node_modules/.vite/unique-string.js
Run framework, version:
vue2.6.12、vue-cli4、vite2.5.5 (The latest version does not work too)
Ask for advice~~

Related

(plugin node-resolve) Error: Error running plugin hook resolveId for node-resolve, expected a function hook

Following 14.0.0 version upgrade for "#rollup/plugin-node-resolve" plugin, when running my build I always get this error message :
[!] (plugin node-resolve) Error: Error running plugin hook resolveId for node-resolve, expected a function hook.
Error: Error running plugin hook resolveId for node-resolve, expected a function hook.
at error (/Users/***/Documents/GitHub/poke/node_modules/rollup/dist/shared/rollup.js:198:30)
at throwInvalidHookError (/Users/***/Documents/GitHub/poke/node_modules/rollup/dist/shared/rollup.js:22635:12)
at /Users/***/Documents/GitHub/poke/node_modules/rollup/dist/shared/rollup.js:22776:24
Was there any breaking change that I should be aware ?

Error: Uncaught (in promise): ChunkLoadError: Loading chunk 24 failed

We have migrated application from angular 4.4 to 8.2.
And also we implemented lazy loading, it seems working fine in local environment with (PROD mode).
But after deployment in different server, it throws chunk files not found.
The command we used :
ng build --prod=true --cross-origin=anonymous --source-map=false
ng build --prod=true --cross-origin=anonymous --source-map=false
Error: Uncaught (in promise): ChunkLoadError: Loading chunk 24 failed.

Angular 4 #ngx-translate Karma Jasmin test cases

Trying to integrate Angular 4 + #ngx-translate. Everything is executing and working properly with npm start. Problem arises when I tries to npm test run Karma test cases. All these started after adding #ngx-translate capabilities.
Console get below error:
20 09 2017 14:24:30.334:INFO [Chrome 60.0.3112 (Windows 7 0.0.0)]: Connected on socket n1uvSjMzMfCGU26zAAAA with id 7587189
Chrome 60.0.3112 (Windows 7 0.0.0) ERROR
Uncaught TypeError: Cannot read property 'Injectable' of undefined
at node_modules/#ngx-translate/core/bundles/core.umd.js:817
On browser console:
Uncaught TypeError: Cannot read property 'Injectable' of undefined
at Object.<anonymous> (core.umd.js:817)
at __webpack_require__ (core.umd.js:30)
at Object.module.exports (core.umd.js:1421)
at __webpack_require__ (core.umd.js:30)
at module.exports (core.umd.js:76)
at core.umd.js:79
at webpackUniversalModuleDefinition (core.umd.js:9)
at core.umd.js:10
ng-bootstrap.js:9 Uncaught TypeError: Cannot read property 'core' of undefined
at webpackUniversalModuleDefinition (ng-bootstrap.js:9)
at ng-bootstrap.js:10
On browser:
OtherComponent when inside a test host should process Instance name
TypeError: Cannot read property 'bpmWrapWorkItemList' of undefined
TypeError: Cannot read property 'bpmWrapWorkItemList' of undefined
Please help !!! I am new to Angular 4..
Please put beforeEach block to update language for translateservice
beforeEach(inject([TranslateService], (service: TranslateService) => {
service.use('de');
}));
I had a similar issue, and was able to resolve the problem by removing two script definitions in .angular-cli.json.
I replaced
"scripts": [
"../node_modules/#ngx-translate/core/bundles/core.umd.js",
"../node_modules/#ngx-translate/http-loader/bundles/http-loader.umd.js"
],
with
"scripts": [],
While this resolves the problem, and the translate service still works, I do not know why those scripts are required in the first place, and if it's okay to remove them.

Getting Failed to load %5Bobject%20Object%5D on Webpack generated js hosted in express due to stylus styles

I am working on augmenting the example found here. So first of all it works great if I call npm start. Now I wanted to try and get it to work with an existing ExpressJS project. To do this in a quick and dirty way I copy the three js files to the ./public/javascripts folder and create the following index.jade...
extends layout
block content
my-app Loading....
script(type="text/javascript", src="http://localhost:3000/javascripts/polyfills.js")
script(type="text/javascript", src="http://localhost:3000/javascripts/vendor.js")
script(type="text/javascript", src="http://localhost:3000/javascripts/app.js")
but now I get....
Error: Uncaught (in promise): Failed to load %5Bobject%20Object%5D
at resolvePromise (zone.js:538)
at PromiseCompleter.reject (zone.js:515)
at application_ref.js:349
at ZoneDelegate.invoke (zone.js:323)
at Object.NgZoneImpl.inner.inner.fork.onInvoke (ng_zone_impl.js:48)
at ZoneDelegate.invoke (zone.js:322)
at Zone.run (zone.js:216)
at zone.js:571
at ZoneDelegate.invokeTask (zone.js:356)
at Object.NgZoneImpl.inner.inner.fork.onInvokeTask (ng_zone_impl.js:39)
at ZoneDelegate.invokeTask (zone.js:355)
at Zone.runTask (zone.js:256)
at drainMicroTaskQueue (zone.js:474)
at XMLHttpRequest.ZoneTask.ZoneTask.cancelFn.invoke (zone.js:426)
zone.js:461 Unhandled Promise rejection: Failed to load %5Bobject%20Object%5D ; Zone: angular ; Task: Promise.then ; Value: Failed to load %5Bobject%20Object%5DconsoleError # zone.js:461_loop_1 # zone.js:490drainMicroTaskQueue #zone.js:494ZoneTask.ZoneTask.cancelFn.invoke # zone.js:426
Current project is available here
So for some reason this worked with the built in webpack server
styleUrls: [String(require('./navbar.component.styl'))]
This of course should be
styles: [String(require('./navbar.component.styl'))]

aurelia-dialog TypeError: _aureliaPal.DOM.injectStyles is not a function

I've simply installed the aurelia-dialog plugin, version 1.0.0-beta.1.1.0, and registered it with aurelia, but I'm getting an error:
aurelia.use
.plugin('aurelia-dialog');
dialog-configuration.js:65 Uncaught (in promise) TypeError: _aureliaPal.DOM.injectStyles is not a function(…)
_apply # dialog-configuration.js:65
configure # aurelia-dialog.js:73
(anonymous function) # aurelia-framework.js:272
I just experienced the same problem - solved it by running "jspm update", which caused several aurelia packages to be updated from beta-1.2.1 or beta-1.2.2 to rc-1.0.0 and added various other packages. Hence, the problem seems to be caused by some kind of version conflict.