Comments (13)
Yes, we'll have to check on that in redbean; thank you for the update!
from fullmoon.
@lost4git, everything looks correct in your project setup, but for some reason redbean is not looking in any of the /zip/ folders. This is how the same message looks for me:
E2022-06-07T18:38:56+001281:tool/net/redbean.c:1043:cosmobin:13188] (lua) failed to run lua code: /.init.lua:1: module 'techbench' not found:
no field package.preload['techbench']
no file '/zip/.lua/techbench.lua'
no file '/zip/.lua/techbench/init.lua'
no file '/zip/.lua/techbench.so'
no file '/zip/.lua/loadall.so'
no file './techbench.so'
stack traceback:
[C]: in function 'require'
/.init.lua:1: in main chunk
Notice that in my case it checks /zip/.lua/techbench.lua
, which is where the file is in your case, but in your stacktrace these paths are not listed. Did you build your redbean copy yourself?
from fullmoon.
My build script file (powershell)
build.ps1
$ErrorActionPreference = "Stop"
$redbeanUri = "https://justine.lol/redbean/redbean-latest.com"
$redbeanPath = "./redbean.com"
$redbeanBuildPath = "./redbean-build.com"
$luaPath = "./.lua"
$initLuaPath = "./.init.lua"
if(Test-Path $redbeanBuildPath)
{
Remove-Item $redbeanBuildPath
}
"Checking redbean.com whether exists..."
if(-not $(Test-Path $redbeanPath))
{
"Downloading redbean.com from $redbeanUri to $redbeanPath"
Invoke-WebRequest -Uri $redbeanUri -OutFile $redbeanPath
}
"Creating ./.lua folder..."
if($(Test-Path $luaPath))
{
Remove-Item -Recurse $luaPath
}
mkdir $luaPath
"Copying fullmoon.lua to ./.lua folder..."
Copy-Item "./fullmoon.lua" "$luaPath/fullmoon.lua"
"Copying techbench.lua to ./.lua folder..."
Copy-Item "./examples/techbench.lua" "$luaPath/techbench.lua"
"Generating .init.lua..."
Set-Content -Value "require 'techbench'" -Path $initLuaPath
Write-Host "> Whether to package the resources to redbean.com and start readbean.com (Y/N): " -ForegroundColor Yellow -NoNewline
$toPackage = Read-Host
if(($toPackage -ne "Y") -and ($toPackage -ne "y"))
{
return
}
"Packaging to redbean.com..."
Copy-Item $redbeanPath $redbeanBuildPath
zip $redbeanBuildPath "$luaPath/fullmoon.lua" "$luaPath/techbench.lua"
zip $redbeanBuildPath $initLuaPath
"Starting redbean.com..."
. $redbeanBuildPath -vvmbag
from fullmoon.
I suspect it's the same issue as #2, as you appear to be using redbean 1.5. I'd expect this to be fixed when redbean 2.0 is out (or if you build redbean with any version 1.6+).
from fullmoon.
@lost4git, can you re-test with the current redbean version: https://justine.lol/redbean/redbean-latest.com? I expect the issue to be resolved.
from fullmoon.
@pkulchenko
I found that it is already v2.0, but the problem still exists
D2022-06-14T00:00:45.102047:tool/net/redbean.c:4922:redbean-build:1084] (lua) LuaRunAsset("/.init.lua")
E2022-06-14T00:00:45+000000:tool/net/redbean.c:1047:redbean-build:1084] (lua) failed to run lua code: /.init.lua:1: module 'techbench' not found:
no field package.preload['techbench']
no file '/E/scoop/global/apps/lua/current' // still try to load module from my local lua home?
no file '/E/scoop/global/apps/lua/current'
stack traceback:
[C]: in function 'require'
/.init.lua:1: in main chunk
from fullmoon.
my build script output
from fullmoon.
There may be an issue with your build script, try this, (note I use: bash -c './redbean.com -v'
, because I am using zsh.)
git clone [email protected]:pkulchenko/fullmoon.git \
&& cd fullmoon \
&& curl https://redbean.dev/redbean-latest.com >redbean.com \
&& chmod +x redbean.com \
&& mkdir .lua \
&& cp fullmoon.lua .lua \
&& cp examples/techbench.lua .lua \
&& echo 'require "techbench"' >.init.lua \
&& zip redbean.com .init.lua .lua/fullmoon.lua .lua/techbench.lua \
&& bash -c './redbean.com -v'
then to confirm working:
curl http://127.0.0.1:8080/json
from fullmoon.
@imaitland same problem in WSL
from fullmoon.
I can't reproduce this and the script that @imaitland posted works for me.
I don't understand where /E/scoop/global/apps...
path is coming from and why there is no /zip/...
paths that should be added by default: https://github.com/jart/cosmopolitan/blob/master/tool/net/redbean.c#L5199.
In any case, it doesn't seem like it's a fullmoon issue, as your copy of redbean for some reason doesn't set proper lua paths, so the modules are not loaded. I'm a bit at a loss here. Can you run redbean with --ftrace option and check if LuaStart
and GetDefaultLuaPath
functions are on the list?
from fullmoon.
it works for me now
from fullmoon.
Thanks to @pkulchenko for your patient answer
from fullmoon.
Maybe redbean needs to adjust the priority of the lua path
from fullmoon.
Related Issues (18)
- hand over route back to the redbean core if no matching fullmoon route HOT 3
- Uncertain how to obtain query parameters HOT 6
- Any CRUD example for using SQLite? HOT 2
- Any help with DNS/virtual hosting/ip address? HOT 3
- Support for multipart/form-data to allow uploading files HOT 10
- serveRedirect parameter order HOT 1
- [Suggestion] Disable Listing HOT 4
- [Suggestion] Built-in DDOS Protection HOT 3
- Processing layouts HOT 6
- Issue with techbench example HOT 6
- multipart form validation HOT 4
- using booleans in oneof rules HOT 2
- In the instructions: "curl -o redbean.com https://justine.lol/redbean/redbean-latest.com" does not work HOT 3
- Feature request: form input validation HOT 13
- Windows Defender Virus Detected HOT 4
- Custom template engines? HOT 4
- Getting the body of the request HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fullmoon.