ClojureScript: TypeError: $jscomp.inherits is not a function - clojurescript

I have three imports from node_modules:
["web3" :as Web3js]
["web3modal" :default Web3Modal]
["#walletconnect/web3-provider" :default WalletConnectProvider]
If I comment out web3 and #walletconnect/web3-provider then everything is ok, but when I try to import these two libs I receive an error in the console: Failed to load woodenstaking_ui/components/connect_btn.cljs TypeError: $jscomp.inherits is not a function
Before it was working without problems, I don't understand what happened, why they stopped working. The problem appeared after importing another library from npm, but I already removed it, removed node_modules folder, made again npm install, but it did not help.

stop shadow-cljs
remove the .shadow-cljs folder and your :output-to folder
restart shadow-cljs

Related

The required JS dependency "readable-stream/writable.js" is not available, it was required by "node_modules/stream-browserify/index.js"

I am getting this error when trying to build a Clojurescript project with shadow-cljs. I've tried looking for syntax errors as described here but I can get the same the error with a single line and a single import although not all imports cause the same error.
This compiles:
(ns campfire.core)
(defn init [] (println "ok"))
This doesn't:
(ns campfire.core
(:require ["bugout" :as b]))
(defn init [] (println "ok"))
The output from the above example is:
shadow-cljs - config: /home/ru/Projects/campfire/shadow-cljs.edn
shadow-cljs - HTTP server available at http://localhost:3000
shadow-cljs - server version: 2.11.18 running at http://localhost:9630
shadow-cljs - nREPL server started on port 8777
shadow-cljs - watching build :frontend
[:frontend] Configuring build.
[:frontend] Compiling ...
[:frontend] Build failure:
The required JS dependency "readable-stream/writable.js" is not available, it was required by "node_modules/stream-browserify/index.js".
Dependency Trace:
campfire/core.cljs
node_modules/bugout/index.js
node_modules/bs58check/index.js
node_modules/create-hash/browser.js
node_modules/cipher-base/index.js
node_modules/stream-browserify/index.js
Searched for npm packages in:
/home/ru/Projects/campfire/node_modules
See: https://shadow-cljs.github.io/docs/UsersGuide.html#npm-install
package.json
{
"name": "campfire",
"version": "0.0.1",
"private": true,
"scripts": {
"build": "shadow-cljs release frontend"
},
"devDependencies": {
"shadow-cljs": "2.11.18"
},
"dependencies": {
"bugout": "^0.0.10",
"webtorrent": "^0.114.1"
}
}
shadow-cljs.edn
{:source-paths
["src/dev"
"src/main"
"src/test"]
:dependencies
[]
:dev-http {3000 "public"}
:nrepl {:port 8777}
:builds
{:frontend
{:target :browser
:modules {:main {:init-fn campfire.core/init}}}}}
I've seen similar build errors that were fixed by clearing .shadow-cljs etc and rebuilding but nothing like that seems to be helping. I'm new to shadow so apologies if this is something obvious. Does anyone have any idea what's going on here?
Update
So it looks like what's happening is that stream-browserify 2.0.2 requires readable stream ^2.0.2 which npm installs in the nested node_modules folder. Elsewhere readable-stream 3.6.0 is being installed in top level node_modules. Shadow is trying to resolve writer.js against the 3.6.0 version of readable stream instead of the 2.0.2 version.
Confusingly though, stream-browserify isn't a dependency of cipher-base as given in the dependency trace but of node-libs-browser which is itself a dependency of shadow-cljs.
Is it possible that this is a bug in shadow or is it expected behaviour?
Update 2
I've created an example repo that replicates what I'm seeing as simply as I can here.
Did you actually install the shadow-cljs dependency in the project? Does the directory node_modules/shadow-cljs exist?
I see it listed in devDependencies so it should be installed but it might not be if you never actually called npm install in the project or npm is set to production mode which won't install devDependencies. All of this is part of the node-libs-browser package which seems to be missing as well and should have been installed due to being a dependency of shadow-cljs.
Based on the link in your first error message, it says to npm install whatever's missing.
If you didn't run npm install, that by itself will install what's in your package.json.
If that's not the issue, then npm i readable-stream may help.

jekyll-theme-primer bootsrap.min cannot be found

I am trying to run https://github.com/fossasia/gci18.fossasia.org/ locally.
I did it once with jekyll (on an older version of the site) and it worked.
Now, I cloned it so it is updated, but I cannot get it to work. I keep getting an error message that says
Conversion error: Jekyll::Converters::Scss encountered an error while converting 'css/style.scss':
File to import not found or unreadable: bootstrap.min. Load path: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-theme-primer-0.5.3/_sass on line 1
jekyll 3.7.4 | Error: File to import not found or unreadable: bootstrap.min.
Load path: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-theme-primer-0.5.3/_sass on line 1
I have tried reinstalling jekyll-theme-primer but it is not working. How can I fix this?
Per the Jekyll Documentation, you'll want to put all of your SCSS partials (such as bootstrap.min.css, themify-icon.css, and the other files imported in /css/style.scss) into the /_sass/ directory for automatic conversion.
Alternatively, you can specify .css in your import statements. For example:
# /css/style.scss
#import 'bootstrap.min.css';
#import 'themify-icon.css';
...
See https://jekyllrb.com/docs/assets/#sassscss for more information.

how to resolve ResolveLibraryProjectImports" task failed unexpectedly Exception

ResolveLibraryProjectImports" task failed unexpectedly
System.IO.FileNotFoundException Could not load assembly
I have tried to resolve it like clean bin, obj rebuild again said in the previous results of this issue but it doesn't work for me. Does anyone have a solution for this issue, please help me.
Note: I am having an error in Mono.Android in the References of portable code is this the problem and how to resolve this also?
This is the error I get:
Error The "ResolveLibraryProjectImports" task failed unexpectedly. System.IO.FileNotFoundException: Could not load assembly 'SampleProject, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'SampleProject.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection1 jars, ICollection1 resolvedResourceDirectories, ICollection1 resolvedAssetDirectories, ICollection1 resolvedEnvironments)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() SampleProject.Android Build
=> delete all from C:\Users\username\AppData\Local\Xamarin
=> delete .vs folder
=> restart visual studio in run as admin(if not).
=> clean and rebuild.
Mono.Android is purely a native Android dll for Xamarin.Android
using this in your portable project will throw an error (Of Course.)
This might be the issue if the error still persists after removing the dll then I would suggest you remove the bin obj folders and clean build and in case it still persists you should upload the output window for the debug build as well as error list explanation for this particular error.

Gulp resolve failed

When I run my command:
gulp build
I get the error:
[13:28:52] Requiring external module babel-register
node_modules/nan
resolve failed for "caniuse-db": Error: Cannot find module 'caniuse-db'
resolve failed for "babel-runtime": Error: Cannot find module 'babel-runtime'
This seems to happen after I changed my preset in my .babelrc from es2015 to es2015-loose.
The stacktraces on this GitHub issue seem very similar to yours... They resolved the issue by switching from the es2015-loose preset to the es2015 preset with the loose option:
["es2015", { "loose": true }]

Load new module in Kamailio

I would like to ask, how can I load new module in Kamailio 4.1.2?
Actually, I have an issue, when I tried to compile my kamaiio.cfg
I've got error:
root#kamailio:/usr/local/# kamailio -c kamailio.cfg
loading modules under /usr/local/lib64/kamailio/modules/
0(25392) ERROR: <core> [sr_module.c:587]: load_module(): ERROR: load_module: could not find module <websocket> in </usr/local/lib64/kamailio/modules/>
0(25392) : <core> [cfg.y:3408]: yyerror_at(): parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 323, column 12-25: failed to load module
0(25392) ERROR: <core> [cfg.y:3272]: yyparse(): cfg. parser: failed to find command ws_handle_handshake
0(25392) : <core> [cfg.y:3411]: yyerror_at(): parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 1083, column 27: unknown command, missing loadmodule?
ERROR: bad config file (2 errors)
when I look physically to the /usr/local/lib64/kamailio/modules/ there is some modules, but websocket.so is missing.
So, how can I get and load module in Kamailio?
Thank you for help!
You haven't installed the module websocket. Edit modules.lst file in the source code directory and add websocket to include_modules variable. If you don't have modules.lst, just do:
make cfg
Alternative is to do:
make cfg include_modules="websocket"
By default, the build system for kamailio compiles and install only the modules that have the same dependencies as the core of the application. For websocket you need to install libunistring and openssl (libssl) devel packages.
Steps to load new module to Kamailio server. (Try if above answer is not working for you)
Check the modules is exist in the default module directly /usr/local/lib64/kamailio/modules.
If found, add loadmodule "module_name.so" in load module section in kamailio.cfg file.
If the module is not found in default module directory, you can check for the source code of that module in the default module source code directory /usr/local/src/kamailio-4.4/kamailio/modules.
If source code found, enter to the module directory. Then create modules' shared object file(.so) by following commands.
./configure
make
make test
make install
Then you will get a shared object file(.so). Copy that file into the default module directory. and load this module from the kamailio.cfg file as mentioned in step 1.
If module source code does not exist in the default source code directory, You need to download the source code from the web. And follow step 3 and 4.