SlimScroll Error: Module build failed at ng2-slimscroll/index.ts - jhipster

I have followed below steps Source from https://github.com/jkuri/ng2-slimscroll
Installation
npm install ng2-slimscroll
Imported module like
import { SlimScrollModule } from 'ng2-slimscroll';
imports: [ ....................,
SlimScrollModule,
......................]
facing Error in nodemodules/ng2-slimscroll/index.ts like
ERROR in ./~/ng2-slimscroll/index.ts
Module build failed: Error
at new FatalError (E:\ReconWorkspace\AgreeGateway\node_modules\tslint\lib\error.js:40:23)
at Function.findConfiguration (E:\ReconWorkspace\AgreeGateway\node_modules\tslint\lib\configurat
ion.js:47:15)
at resolveOptions (E:\ReconWorkspace\AgreeGateway\node_modules\tslint-loader\index.js:35:64)
at Object.module.exports (E:\ReconWorkspace\AgreeGateway\node_modules\tslint-loader\index.js:124
:17)
# ./src/main/webapp/app/test/test.module.ts 21:23-48
# ./src/main/webapp/app/app.module.ts
# ./src/main/webapp/app/app.main.ts
# multi (webpack)-dev-server/client?http://localhost:9060 webpack/hot/dev-server ./src/main/webapp/
app/app.main

Related

Module not found: Error: Can't resolve 'fs' in '/home/user/Desktop/all/editor/node_modules/winston/dist/winston'

I was trying to add winston logger to the project, but getting these errors:
ERROR in ./node_modules/winston/dist/winston/tail-file.js
Module not found: Error: Can't resolve 'fs' in '/home/user/Desktop/all/editor/node_modules/winston/dist/winston'
# ./node_modules/winston/dist/winston/tail-file.js 9:9-22
# ./node_modules/winston/dist/winston/transports/file.js
# ./node_modules/winston/dist/winston/transports/index.js
# ./node_modules/winston/dist/winston.js
# ./winston.js
# ./client/modules/App/App.jsx
# ./client/routes.jsx
# ./client/index.jsx
# multi core-js/modules/es6.promise core-js/modules/es6.array.iterator webpack-hot-middleware/client react-hot-loader/patch ./client/index.jsx
ERROR in ./node_modules/winston/dist/winston/transports/file.js
Module not found: Error: Can't resolve 'fs' in '/home/user/Desktop/all/editor/node_modules/winston/dist/winston/transports'
# ./node_modules/winston/dist/winston/transports/file.js 33:9-22
# ./node_modules/winston/dist/winston/transports/index.js
# ./node_modules/winston/dist/winston.js
# ./winston.js
# ./client/modules/App/App.jsx
# ./client/routes.jsx
# ./client/index.jsx
# multi core-js/modules/es6.promise core-js/modules/es6.array.iterator webpack-hot-middleware/client react-hot-loader/patch ./client/index.jsx
I have already tried adding node: { fs: 'empty' } in webpack config file and also tried target: 'node' . It's not working.
In my case I was importing winston in a browser environment and winston does not support browser environment yet.
Check shawnxusy's comment here: https://github.com/winstonjs/winston/issues/925

nodejs - Can't resolve 'child_process' with gRPC and webpack

I'm trying to use gRPC with javascript. I want to use the gRPC package, as I need to send some metadata, but I get an error when I'm using require('grpc').
Here's the error message:
Can't resolve 'child_process'
ERROR in ./node_modules/detect-libc/lib/detect-libc.js
Module not found: Error: Can't resolve 'child_process' in '/home/sglab/dev/grpc-web/client/node_modules/detect-libc/lib'
# ./node_modules/detect-libc/lib/detect-libc.js 4:16-40
# ./node_modules/node-pre-gyp/lib/util/versioning.js
# ./node_modules/node-pre-gyp/lib/pre-binding.js
# ./node_modules/grpc/src/grpc_extension.js
# ./node_modules/grpc/index.js
# ./client.js
ERROR in ./node_modules/detect-libc/lib/detect-libc.js
Module not found: Error: Can't resolve 'fs' in '/home/sglab/dev/grpc-web/client/node_modules/detect-libc/lib'
# ./node_modules/detect-libc/lib/detect-libc.js 5:18-31
# ./node_modules/node-pre-gyp/lib/util/versioning.js
# ./node_modules/node-pre-gyp/lib/pre-binding.js
# ./node_modules/grpc/src/grpc_extension.js
# ./node_modules/grpc/index.js
# ./client.js
ERROR in ./node_modules/fs.realpath/old.js
Module not found: Error: Can't resolve 'fs' in '/home/sglab/dev/grpc-web/client/node_modules/fs.realpath'
# ./node_modules/fs.realpath/old.js 24:9-22
# ./node_modules/fs.realpath/index.js
# ./node_modules/glob/glob.js
# ./node_modules/rimraf/rimraf.js
# ./node_modules/node-pre-gyp/lib/util/napi.js
# ./node_modules/node-pre-gyp/lib/pre-binding.js
# ./node_modules/grpc/src/grpc_extension.js
# ./node_modules/grpc/index.js
# ./client.js
ERROR in ./node_modules/glob/glob.js
Module not found: Error: Can't resolve 'fs' in '/home/sglab/dev/grpc-web/client/node_modules/glob'
# ./node_modules/glob/glob.js 43:9-22
# ./node_modules/rimraf/rimraf.js
# ./node_modules/node-pre-gyp/lib/util/napi.js
# ./node_modules/node-pre-gyp/lib/pre-binding.js
# ./node_modules/grpc/src/grpc_extension.js
# ./node_modules/grpc/index.js
# ./client.js
ERROR in ./node_modules/glob/sync.js
Module not found: Error: Can't resolve 'fs' in '/home/sglab/dev/grpc-web/client/node_modules/glob'
# ./node_modules/glob/sync.js 4:9-22
# ./node_modules/glob/glob.js
# ./node_modules/rimraf/rimraf.js
# ./node_modules/node-pre-gyp/lib/util/napi.js
# ./node_modules/node-pre-gyp/lib/pre-binding.js
# ./node_modules/grpc/src/grpc_extension.js
# ./node_modules/grpc/index.js
# ./client.js
ERROR in ./node_modules/grpc/index.js
Module not found: Error: Can't resolve 'fs' in '/home/sglab/dev/grpc-web/client/node_modules/grpc'
# ./node_modules/grpc/index.js 22:9-22
# ./client.js
ERROR in ./node_modules/grpc/src/grpc_extension.js
Module not found: Error: Can't resolve 'fs' in '/home/sglab/dev/grpc-web/client/node_modules/grpc/src'
# ./node_modules/grpc/src/grpc_extension.js 34:11-24
# ./node_modules/grpc/index.js
# ./client.js
ERROR in ./node_modules/rimraf/rimraf.js
Module not found: Error: Can't resolve 'fs' in '/home/sglab/dev/grpc-web/client/node_modules/rimraf'
# ./node_modules/rimraf/rimraf.js 6:9-22
# ./node_modules/node-pre-gyp/lib/util/napi.js
# ./node_modules/node-pre-gyp/lib/pre-binding.js
# ./node_modules/grpc/src/grpc_extension.js
# ./node_modules/grpc/index.js
# ./client.js
The problems shows when I use this line: var grpc = required('grpc') and this command: npx webpack <file>.
Here's package.json file:
{
"name": "example",
"version": "0.1.0",
"description": "example",
"devDependencies": {
"#grpc/proto-loader": "^0.3.0",
"google-protobuf": "^3.6.1",
"grpc": "^1.24.4",
"grpc-web": "^1.0.0",
"webpack": "^4.16.5",
"webpack-cli": "^3.1.0"
}
}
I'm not really familiar with node.js, so it would be great if someone could explain it to me.
Thanks in advance for help!

npm install node-geocoder issue while running npm run build in type script + PCF (Powerapps Component Framework)

I have created a PCF (Powerapps Component Framework) in which I am using the GEOCODE feature. I have installed the required components using "npm install node-geocoder" and have added the below code :
let nodeGeocoder = require('node-geocoder');
let options = {
provider: 'openstreetmap'
};
let geoCoder = nodeGeocoder(options);
geoCoder.geocode('Luray Caverns')
.then((res)=> {
console.log(res[0].latitude);
console.log(res[0].longitude);
})
.catch((err)=> {
console.log(err);
});
When i build this code using "npm run build", the build fails with following error:
ERROR in ./node_modules/request/lib/har.js
Module not found: Error: Can't resolve 'fs' in 'D:\PCF\Demo\node_modules\request\lib'
Module not found: Error: Can't resolve 'net' in 'D:\PCF\Demo\node_modules\forever-agent'
ERROR in ./node_modules/node-geocoder/lib/geocoder/agolgeocoder.js
Module not found: Error: Can't resolve 'net' in 'D:\PCF\Demo\node_modules\node-geocoder\lib\geocoder'
ERROR in ./node_modules/node-geocoder/lib/geocoder/datasciencetoolkitgeocoder.js
Module not found: Error: Can't resolve 'net' in 'D:\PCF\Demo\node_modules\node-geocoder\lib\geocoder'
ERROR in ./node_modules/node-geocoder/lib/geocoder/abstractgeocoder.js
Module not found: Error: Can't resolve 'net' in 'D:\PCF\Demo\node_modules\node-geocoder\lib\geocoder'
Any help would be helpful.
Thanks in advance.

Webpack - NodeJS - Module not found: Error: Can't resolve 'fs'

I am getting following error, when build nodejs project with webpack.
ERROR in ./node_modules/mime/mime.js
Module not found: Error: Can't resolve 'fs' in 'C:\Sample\node-ts-sample\node_modules\mime'
# ./node_modules/mime/mime.js 2:9-22
# ./node_modules/send/index.js
# ./node_modules/express/lib/response.js
# ./node_modules/express/lib/express.js
# ./node_modules/express/index.js
# ./src/server.ts
# ./src/index.ts
It was a node application. Added a following node in webpack config solved my issue
target:'node',
I refereed the article at https://jlongster.com/Backend-Apps-with-Webpack--Part-I
Simply add this to your webpack config file:
const webpackConfig = {
target: 'node'
};
module.exports = webpackConfig;

TypeError: jsdom.createVirtualConsole is not a function

I am trying to build upon the basic Scala.js tutorial and am having this weird error.
There isn't much different from the project set-up as shown in the tutorial, but just in case here's my build.sbt:
enablePlugins(ScalaJSPlugin)
scalaVersion := "2.12.1"
name := "algorithms1_4_34"
version := "1.0"
libraryDependencies ++= Seq("org.scalatest" % "scalatest_2.12" % "3.0.1" % "test",
"org.scalacheck" %% "scalacheck" % "1.13.4" % "test",
"org.scala-js" % "scalajs-dom_sjs0.6_2.12" % "0.9.1",
"be.doeraene" %%% "scalajs-jquery" % "0.9.1")
// This is an application with a main method
scalaJSUseMainModuleInitializer := true
skip in packageJSDependencies := false
jsDependencies +=
"org.webjars" % "jquery" % "2.1.4" / "2.1.4/jquery.js"
jsDependencies += RuntimeDOM
...and the JSApp file:
package ca.vgorcinschi.algorithms1_4_34
import scala.scalajs.js.JSApp
import org.scalajs.jquery.jQuery
object HotAndColdJS extends JSApp{
def main(): Unit = {
jQuery(()=>setupUI())
}
def addClickedMessage():Unit ={
jQuery("body").append("<p>You clicked the button!</p>")
}
def setupUI():Unit = {
//click envokes an event handler
jQuery("#click-me-button").click(()=> addClickedMessage())
jQuery("body").append("<p>Hello World!</p>")
}
}
I can run compile, fastOptJS, reload and eclipse (I am using eclipsePlugin) commands without problems. The only issue is the run command. To be fair I did add something to the flow of the tutorial, but only because running this command (npm install jsdom) from the root of application lead to failure in run as well (npm WARN enoent ENOENT). Following this as advised here I ran:
npm init
npm install
npm install jsdom
And this is where I am now. This is the error I get when running the app with run:
> run
[info] Running ca.vgorcinschi.algorithms1_4_34.HotAndColdJS
[error] [stdin]:40
[error] virtualConsole: jsdom.createVirtualConsole().sendTo(console),
[error] ^
[error]
[error] TypeError: jsdom.createVirtualConsole is not a function
[error] at [stdin]:40:27
[error] at [stdin]:61:3
[error] at ContextifyScript.Script.runInThisContext (vm.js:23:33)
[error] at Object.runInThisContext (vm.js:95:38)
[error] at Object.<anonymous> ([stdin]-wrapper:6:22)
[error] at Module._compile (module.js:571:32)
[error] at evalScript (bootstrap_node.js:391:27)
[error] at Socket.<anonymous> (bootstrap_node.js:188:13)
[error] at emitNone (events.js:91:20)
[error] at Socket.emit (events.js:188:7)
org.scalajs.jsenv.ExternalJSEnv$NonZeroExitException: Node.js with JSDOM exited with code 1
at org.scalajs.jsenv.ExternalJSEnv$AbstractExtRunner.waitForVM(ExternalJSEnv.scala:107)
at org.scalajs.jsenv.ExternalJSEnv$ExtRunner.run(ExternalJSEnv.scala:156)
at org.scalajs.sbtplugin.ScalaJSPluginInternal$.org$scalajs$sbtplugin$ScalaJSPluginInternal$$jsRun(ScalaJSPluginInternal.scala:697)
at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$73$$anonfun$apply$48$$anonfun$apply$49.apply(ScalaJSPluginInternal.scala:814)
at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$73$$anonfun$apply$48$$anonfun$apply$49.apply(ScalaJSPluginInternal.scala:808)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) org.scalajs.jsenv.ExternalJSEnv$NonZeroExitException: Node.js with JSDOM exited with code 1
[error] Total time: 4 s, completed 23-May-2017 9:24:20 PM
I would appreciate if anyone could give me a hand with this.
jsdom v10 introduced some breaking changes wrt. v9, and Scala.js <= 0.6.15 was not prepared for those. That is what's causing the error you're hitting.
Upgrading to Scala.js 0.6.16 will fix your issue. It supports both jsdom v9 and v10.

Resources