Dart and package root - dart

Im running some code using the dart VM from the command line.
the command is:
dart --checked -package-root=/dart/packages test_service.dart
however Im getting an error:
gf_service.dart': error: line 7 pos 1: library handler failed
import 'package:start/start.dart' as start;
Im confused since in the dir referenced by "-package-root" argument Im definitely seeing the "start/start.dart" file, so it exists. the -package-root folder is also correct.
is there something Im missing?
thank you

Normally you don't need the -package-root argument but the directory that contains the script file should have a symbolic link to the packages directory of your package. pub get should create these symlinks.

the solution to this issue is to use "--package-root" as the argument name, and not "-package-root" as googles own dart documentation says
https://www.dartlang.org/docs/dart-up-and-running/contents/ch04-tools-dart-vm.html
(this should be fixed)
Im using dart vm 1.3.0

Related

Warning: Could not find Lua 5.3 in PATH - When Trying to Install Gumbo library with Luarocks

When writing luarocks install gumbo
In the location/directory of my luarocks file in cmd, I am getting the following error
Warning: Could not find Lua 5.3 in PATH.
Modules may not install with the correct configurations. You may want to specify the path prefix to your build of Lua 5.3 using --lua-dir
Installing https://luarocks.org/gumbo-0.5-1.src.rock
Error: Failed finding Lua library. You may need to configure LUA_LIBDIR.
I've added lua53.exe to the same directory, and added the file both to my user variables and system variables in control panel.
Not sure if worth mentioning, but when running lua53.exe and trying to use luarocks install gumbo from there,
the lua53 cmd-like window responds with stdin:1: syntax error near 'install'
I was hoping to do some web scraping with lua, and later on building a World of Warcraft addon that utilizes gumbo to show certain helpful information within the WoW client, but I can't seem to even get the most basic stuff to work...
Setting up LuaRocks on Windows is annoying and I'm not familiar with it myself. If you added both the LuaRocks and Lua 5.3 Windows binaries (Executables and Includes) to your Path system variable:
luarocks path prints the commands for setting up the LUA_PATH and LUA_CPATH system variables.
The config.lua file tells you what your variables.LUA_LIBDIR value is. You can check it with luarocks config. For me that file would be in:
C:/Users/Ketho/AppData/Roaming/luarocks/config-5.3.lua
otherwise you can create an empty file there and put in this line to point it to wherever your Lua folder is:
variables.LUA_LIBDIR = "C:/lua-5.3.5_Win32_bin"
variables.LUA_INCDIR = "C:/lua-5.3.5_Win32_bin/include"
As for using gumbo to show information within WoW, the addon environment is sandboxed. Unless you meant you just want to get the data to hardcode into your addon.

How to build using cra-append-sw now that #babel/polyfill has been deprecated?

I'm trying to add functionality to the serviceworker that create-react-app provides out of the box. Thankfully, cra-append-sw lets me do that without needing to eject from cra.
However, when installing cra-append-sw, npm gives me a warning that #babel/polyfill#7.4.4 has been deprecated (#babel/polyfill is listed as a cra-append-sw dependency):
As of Babel 7.4.0, this package has been deprecated in favor of directly including core-js/stable (to polyfill ECMAScript features) and regenerator-runtime/runtime (needed to use transpiled generator functions):
import "core-js/stable";
import "regenerator-runtime/runtime";
Then, when I try to npm run build to append a custom service worker, the build spits out a long error message, the top of which is:
ERROR in multi ./custom-sw.js
Module not found: Error: Can't resolve './custom-sw.js' in '/Users/michaelmersiades/workspace/vanilla-cra'
resolve './custom-sw.js' in '/Users/--/workspace/vanilla-cra'
using description file: /Users/--/workspace/vanilla-cra/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
and custom-sw.js is not showing up in the build folder.
Is this fixable? If so, how? Or is this an issue for the good ira-append-sw folk?
My thanks in advance to anyone who can help.
Silly error. The custom-sw.js file was inside /src, but it needed to be in / (the root folder).
Moving it to / solved the problem.

Modifying HAProxy Lua Library Path

I am trying to load Lua script from HAProxy. In the Lua script, the following line is causing an error:
local http = require("socket.http")
Intially I gathered from journalctl -xe output that the library was not installed. I installed it using luarocks install luasocket. This did not solve the issue. The new error is module "socket.http" not found. Following the comment in this post I realized that I must change the settings for Lua library path in order to resolve this issue.
Now, I want to know the following:
Do I have install HAProxy+Lua from source and modify the library path pre installation?
If building from source is not necessary then, I believe I must change the path using syslog as suggested by the comment from post linked above. If this is the case, how do I do that and what settings do I need to change/add to syslog.conf?
Are there are any other solution that I am overlooking which, would easier than any of the above?
Thanks for your help in advance.
EDIT 1
I have modified both LUA_PATH and LUA_CPATH as follows:
LUA_PATH=/usr/bin/lua;/usr/bin/lua5.3;/usr/share/lua/5.3/ltn12.lua;/usr/share/lua/5.3/mime.lua;/usr/share/lua/5.3/socket.lua;/usr/share/lua/5.3/ssl.lua;/usr/share/lua/5.3/posix/_argcheck.lua;/usr/share/lua/5.3/posix/compat.lua;/usr/share/lua/5.3/posix/deprecated.lua;/usr/share/lua/5.3/posix/init.lua;/usr/share/lua/5.3/posix/sys.lua;/usr/share/lua/5.3/posix/util.lua;/usr/share/lua/5.3/posix/version.lua;/usr/share/lua/5.3/socket/ftp.lua;/usr/share/lua/5.3/socket/headers.lua;/usr/share/lua/5.3/socket/http.lua;/usr/share/lua/5.3/socket/smtp.lua;/usr/share/lua/5.3/socket/tp.lua;/usr/share/lua/5.3/socket/url.lua;/usr/share/lua/5.3/term/colors.lua;/usr/share/lua/5.3/term/cursor.lua;/usr/share/lua/5.3/term/init.lua;/usr/share/lua/5.3/ssl/https.lua;/usr/share/lua/5.3/luarocks/add.lua;/usr/share/lua/5.3/luarocks/admin_remove.lua;/usr/share/lua/5.3/luarocks/build.lua;/usr/share/lua/5.3/luarocks/cache.lua;/usr/share/lua/5.3/luarocks/cfg.lua;/usr/share/lua/5.3/luarocks/command_line.lua;/usr/share/lua/5.3/luarocks/config_cmd.lua;/usr/share/lua/5.3/luarocks/deps.lua;/usr/share/lua/5.3/luarocks/dir.lua;/usr/share/lua/5.3/luarocks/doc.lua;/usr/share/lua/5.3/luarocks/download.lua;/usr/share/lua/5.3/luarocks/fetch.lua;/usr/share/lua/5.3/luarocks/fs.lua;/usr/share/lua/5.3/luarocks/help.lua;/usr/share/lua/5.3/luarocks/index.lua;/usr/share/lua/5.3/luarocks/install.lua;/usr/share/lua/5.3/luarocks/lint.lua;/usr/share/lua/5.3/luarocks/list.lua;/usr/share/lua/5.3/luarocks/loader.lua;/usr/share/lua/5.3/luarocks/make.lua;/usr/share/lua/5.3/luarocks/make_manifest.lua;/usr/share/lua/5.3/luarocks/manif_core.lua;/usr/share/lua/5.3/luarocks/manif.lua;/usr/share/lua/5.3/luarocks/new_version.lua;/usr/share/lua/5.3/luarocks/pack.lua;/usr/share/lua/5.3/luarocks/path_cmd.lua;/usr/share/lua/5.3/luarocks/path.lua;/usr/share/lua/5.3/luarocks/persist.lua;/usr/share/lua/5.3/luarocks/purge.lua;/usr/share/lua/5.3/luarocks/refresh_cache.lua;/usr/share/lua/5.3/luarocks/remove.lua;/usr/share/lua/5.3/luarocks/repos.lua;/usr/share/lua/5.3/luarocks/require.lua;/usr/share/lua/5.3/luarocks/search.lua;/usr/share/lua/5.3/luarocks/show.lua;/usr/share/lua/5.3/luarocks/site_config.lua;/usr/share/lua/5.3/luarocks/type_check.lua;/usr/share/lua/5.3/luarocks/unpack.lua;/usr/share/lua/5.3/luarocks/upload.lua;/usr/share/lua/5.3/luarocks/util.lua;/usr/share/lua/5.3/luarocks/validate.lua;/usr/share/lua/5.3/luarocks/write_rockspec.lua;/usr/share/lua/5.3/luarocks/build/builtin.lua;/usr/share/lua/5.3/luarocks/build/cmake.lua;/usr/share/lua/5.3/luarocks/build/command.lua;/usr/share/lua/5.3/luarocks/build/make.lua;/usr/share/lua/5.3/luarocks/fs/lua.lua;/usr/share/lua/5.3/luarocks/fs/tools.lua;/usr/share/lua/5.3/luarocks/fs/unix.lua;/usr/share/lua/5.3/luarocks/fs/win32.lua;/usr/share/lua/5.3/luarocks/fetch/cvs.lua;/usr/share/lua/5.3/luarocks/fetch/git_file.lua;/usr/share/lua/5.3/luarocks/fetch/git_http.lua;/usr/share/lua/5.3/luarocks/fetch/git_https.lua;/usr/share/lua/5.3/luarocks/fetch/git.lua;/usr/share/lua/5.3/luarocks/fetch/git_ssh.lua;/usr/share/lua/5.3/luarocks/fetch/hg_http.lua;/usr/share/lua/5.3/luarocks/fetch/hg_https.lua;/usr/share/lua/5.3/luarocks/fetch/hg.lua;/usr/share/lua/5.3/luarocks/fetch/hg_ssh.lua;/usr/share/lua/5.3/luarocks/fetch/sscm.lua;/usr/share/lua/5.3/luarocks/fetch/svn.lua;/usr/share/lua/5.3/luarocks/tools/patch.lua;/usr/share/lua/5.3/luarocks/tools/tar.lua;/usr/share/lua/5.3/luarocks/tools/zip.lua;/usr/share/lua/5.3/luarocks/upload/api.lua;/usr/share/lua/5.3/luarocks/upload/multipart.lua
LUA_CPATH=/usr/lib64/lua/5.3/posix/ctype.so;/usr/lib64/lua/5.3/posix/dirent.so;/usr/lib64/lua/5.3/posix/errno.so;/usr/lib64/lua/5.3/posix/fcntl.so;/usr/lib64/lua/5.3/posix/fnmatch.so;/usr/lib64/lua/5.3/posix/glob.so;/usr/lib64/lua/5.3/posix/grp.so;/usr/lib64/lua/5.3/posix/libgen.so;/usr/lib64/lua/5.3/posix/poll.so;/usr/lib64/lua/5.3/posix/pwd.so;/usr/lib64/lua/5.3/posix/sched.so;/usr/lib64/lua/5.3/posix/signal.so;/usr/lib64/lua/5.3/posix/stdio.so;/usr/lib64/lua/5.3/posix/stdlib.so;/usr/lib64/lua/5.3/posix/syslog.so;/usr/lib64/lua/5.3/posix/termio.so;/usr/lib64/lua/5.3/posix/time.so;/usr/lib64/lua/5.3/posix/unistd.so;/usr/lib64/lua/5.3/posix/utime.so;/usr/lib64/lua/5.3/mime/core.so;/usr/lib64/lua/5.3/socket/core.so;/usr/lib64/lua/5.3/socket/serial.so;/usr/lib64/lua/5.3/socket/unix.so;/usr/lib64/lua/5.3/term/core.so;/usr/lib64/lua/5.3/ssl.so;/usr/lib64/lua/5.3/zlib.so
I am still getting the same error as reported before.
EDIT 2
Found this post on Lua require function quite helpful. Following the discussion, I tried the following:
package.path="/usr/share/lua/5.3/?/?.lua"
package.cpath="/usr/lib64/lua/5.3/?/?.so"
I added these lines at the top my lua script that's causing the error. I also modified the environment variables, LUA_PATH and LUA_CPATH with the same value. The error still persists.
I am out of all possible options at this stage and would be glad if someone can shed some light on this issue.

Lua 5.2 adding luasocket (unstable)

Im trying to use luasocket with lua 5.2. i downloaded the code form the git repository and built it. then made a make install so that it generated core.dll and mime.dll. put those into the custom lua program directory [CPATH] im developing and tried loading it. But i get following error message:
Failed at error loading module 'socket.core' from file 'D:\[..myprogram..]\socket\core.dll':
Module was not found.
how can i check if the dll is correct. or did i do anything wrong?
Thanks
Is your executable residing in the same directory as your lua files?
Try putting the dll in the directory of your executable.
Most likely you are loading socket modules that are compiled for Lua 5.1, not Lua 5.2 (or at least it's the same error I get in a case like that). Is it possible that you have socket module for Lua 5.1 somewhere in your path? It may come with LuaForWindows or another package. You can try to remove/move the socket DLLs you compiled (for Lua 5.2) and see if you get the same error.

mono path for F# installation

I have mono and f# installed and running under linux but wanted to move the directory
of the f# installation. The problem is that, when run with mono, the f# compiler still refers to the old directory. Hence it does not find any dlls and when compiling anything, gives an error like
error FS0078: Unable to find the file 'FSharp.Core.dll' in any of
/usr/lib/mono/2.0
/current/directory
/old/path/of/FSharp-2.0.0.0/bin
Since I start the compiler with everything referring to the new path I think mono still refers to the old installation path at some point, but I could not find where. Adding the new path to the MONO_PATH env and updateing the FSHARP_COMPILER_BIN evn to the new path also did not help.
Is there an easy way to change the F# path so the compiler finds it again?
Did you try rerunning the install-mono.sh script? - that should reinstall everything to the GAC with the new location.

Resources