small-tech / nodekit Goto Github PK
View Code? Open in Web Editor NEW[Moved to Codeberg] A Small Web server.
[Moved to Codeberg] A Small Web server.
From lib/Util.js:
static unprivilegedAccountName () {
if (process.platform === 'win32' || process.env.USER !== 'root') {
// Does not apply to Windows as there is no sudo.
return os.userInfo().username
} else {
return process.env.SUDO_USER
}
}
Not sure if it's a priority to support Node 17, but tried to run an example via bin/nodekit examples/hello-count/
and ran into this error (using Node 17.5.0):
TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///home/andrewchou/Code/GitHub/small-tech/nodekit//node_modules/svelte/package.json" needs an import assertion of type "json"
at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
at new NodeError (node:internal/errors:371:5)
at validateAssertions (node:internal/modules/esm/assert:82:15)
at defaultLoad (node:internal/modules/esm/load:24:3)
at ESMLoader.load (node:internal/modules/esm/loader:359:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:280:58)
at new ModuleJob (node:internal/modules/esm/module_job:66:26)
at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:297:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:261:34)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
at async loaderPaths (file:///home/andrewchou/Code/GitHub/small-tech/nodekit/lib/Utils.js:47:26)
at async file:///home/andrewchou/Code/GitHub/small-tech/nodekit/lib/HydrationScriptCompiler.js:12:43 {
code: 'ERR_IMPORT_ASSERTION_TYPE_MISSING'
}
Offending line seems to be here
Line 47 in dcda503
Was able to fix that specific error locally with this, but then ran into an identical error elsewhere when re-running:
TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///home/andrewchou/Code/GitHub/small-tech/nodekit/package.json" needs an import assertion of type "json"
at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
at new NodeError (node:internal/errors:371:5)
at validateAssertions (node:internal/modules/esm/assert:82:15)
at defaultLoad (node:internal/modules/esm/load:24:3)
at load (file:///home/andrewchou/Code/GitHub/small-tech/nodekit/loader.js:176:10)
at ESMLoader.load (node:internal/modules/esm/loader:359:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:280:58)
at new ModuleJob (node:internal/modules/esm/module_job:66:26)
at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:297:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:261:34)
at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:81:21)
at async Promise.all (index 4)
at async link (node:internal/modules/esm/module_job:86:9) {
code: 'ERR_IMPORT_ASSERTION_TYPE_MISSING'
}
seems to point here (or the load
function in general?)
Line 176 in dcda503
Patching this doesn't seem to be as trivial to me so hence this issue 😅
Command works as expected when trying with Node 16.14.0
Hi I've discover something which look like a bug :
If I create a project with a name containing dot, like "example.node.kit", nodekit fail to show me the page. To avoid that, I must change the name of the directory for a name without any dot.
This is my first issue, so don't hesit to ask me to test some thing to help you, and sorry if this not how an issue must be writed.
From: lib/Util.js:
static unprivilegedHomeDirectory () {
if (process.platform === 'win32') {
return os.homedir()
} else {
// Linuxesque: return non-root home folder even if invoked via sudo.
const accountsFolder = os.platform() === 'darwin' ? 'Users' : 'home'
return `/${accountsFolder}/${Util.unprivilegedAccountName()}`
}
}
From lib/Util.js:
static refuseToRunAsRoot () {
// Refuse to run if this is the root account.
if (process.env.USER === 'root' && process.env.SUDO_USER === undefined) {
// This is an attempt to run Site.js from the root account.
// Reject for security reasons.
console.log(`\n ❌ ${clr('❨site.js❩ Error:', 'red')} Refusing to run from the root account for security reasons.\n`)
console.log(` ${clr('Please create and use an account with regular privileges to run Site.js.', 'yellow')}\n`)
process.exit(1)
}
}
I have just installed nodekit from the terminal.
I try to run:
nodekit examples/simple-chat/index.page
This leads to this error message:
SyntaxError: The requested module 'worker_threads' does not provide an export named 'BroadcastChannel'
at ModuleJob._instantiate (internal/modules/esm/module_job.js:124:21)
at async ModuleJob.run (internal/modules/esm/module_job.js:179:5)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async internal/process/esm_loader.js:57:9
at async Object.loadESM (internal/process/esm_loader.js:67:5)
I'm using Ubuntu 20.04.4 LTS.
I have not yet tested out non-examples.
Thank you for working on this small tech project.
I’m honestly curious why centralized, GAFAM owned and for-profit Github was chosen to host this project source and lifecycle ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.