Git Product home page Git Product logo

nodekit's People

Contributors

aral avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nodekit's Issues

Utility method for getting unprivileged account name

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
  }
}

Serve fails to run on Node 17

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

const svelteExports = (await import(`${nodekitAppPath}/node_modules/svelte/package.json`)).default.exports

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?)

return defaultLoad(url, context, defaultLoad)

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

Nodekit fail with some directory name

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.
image

Utility method for getting unprivileged home directory

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()}`
  }
}

Refuse to run as root

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)
  }
}

Nodekit examples doesn't work out of the box.

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.

Github hosted ?

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 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.