I get an ERROR in ./node_modules/diff2html/src/hoganjs-utils.js
See original GitHub issueDescribe the bug
ERROR in ./node_modules/diff2html/src/hoganjs-utils.js Module not found: Error: Can’t resolve ‘path’ in ‘/Users/xxx/Code/projectname/node_modules/diff2html/src’
To Reproduce Steps to reproduce the behavior:
- npm install diff2html
import { Component, OnInit, ViewChild } from '@angular/core';
import { _HttpClient, ModalHelper } from '@delon/theme';
import { STColumn, STComponent } from '@delon/abc';
import { SFSchema } from '@delon/form';
import {Diff2Html} from 'diff2html'
@Component({
selector: 'app-switch-config',
templateUrl: './config.component.html',
})
export class SwitchConfigComponent implements OnInit {
outputHtml = '';
constructor(private http: _HttpClient, private modal: ModalHelper) { this.init()}
ngOnInit() { }
init() {
let strInput = "--- a/server/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go\n+++ b/server/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go\n@@ -1035,6 +1035,17 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (\n \n // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n \n+func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {\n+\tr0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)))\n+\tn = int(r0)\n+\tif e1 != 0 {\n+\t\terr = errnoErr(e1)\n+\t}\n+\treturn\n+}\n+\n+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n+\n func read(fd int, p []byte) (n int, err error) {\n \tvar _p0 unsafe.Pointer\n \tif len(p) > 0 {\n";
let outputHtml = Diff2Html.getPrettyHtml(strInput, {inputFormat: 'diff', showFiles: true, matching: 'lines'});
this.outputHtml = outputHtml;
}
}
</page-header>
<nz-card>
<div [innerHtml]="outputHtml"></div>
</nz-card>
- run and See error
Desktop (please complete the following information):
- OS: [Mac]
- Browser [Chrome]
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Error - JavaScript - MDN Web Docs - Mozilla
Error objects are thrown when runtime errors occur. The Error object can also be used as a base object for user-defined exceptions.
Read more >JS: How to get err.code? In my code it is always undefined
I misunderstood the question with my original answer. To my understanding there is no .code property on the error object returned within a...
Read more >JavaScript Errors Try Catch Throw - W3Schools
The throw statement defines a custom error. Errors Will Happen! When executing JavaScript code, different errors can occur. Errors can be coding errors...
Read more >Node.js Error Handling: Tips and Tricks | AppSignal Blog
In this post, we'll first look at the two common types of errors. We'll then explore how to handle errors in Node.js and...
Read more >15 Common Error Codes in Node.js and How to Fix Them
Therefore, we've compiled this list of 15 common Node.js errors along with ... If you get this error in your Node.js application or...
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 Free
Top 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
@i6448038 thanks for the help. I will try to review the deps and maybe fix this. @farlock85 For now please use the suggestion by @i6448038.
@farlock85 @rtfpessoa I have already solved this problem. I just add the
path
module withnpm install path
and it worked!