totaljs / framework4

Total.js framework v4
https://www.totaljs.com
Other
97 stars 36 forks source link

Running v4 #5

Closed GerhardMes closed 3 years ago

GerhardMes commented 3 years ago

Hello, I wanted to test the new version. And I installed it, as mentioned. then I tried to run the cms for testing. But I get an error message.

node index.js        
internal/modules/cjs/loader.js:983
  throw err;
  ^

Error: Cannot find module 'total4/debug'
... /..../cms/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1042:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/..../cms/index.js:19:2)
    at Module._compile (internal/modules/cjs/loader.js:1156:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/..../cms/index.js' ]

Do I have to "uninstall" the previous version first? Calling --version, it says 4.0.0. Therefore, everything is fine with the install process, right?

GerhardMes commented 3 years ago

It is funny. I tried to play around with the electron-packager. Didn't worked, but now the cms ist running. I have no idea what made it; but I am happy. Cheers Gerhard

petersirka commented 3 years ago

You didn't have installed Total.js 4 from NPM Error: Cannot find module 'total4/debug' ... but if it works, then OK 👍

DominikusKrueger commented 1 year ago

Hi! I have a very similar (my guess: the very same) problem. I was following the tutorial for running totaljs v4 (https://docs.totaljs.com/total4/40cfc001mn51c/) on a fresh ubuntu 22.04 VM, installed node 16.18.0, and total4 via "npm install -g total4". When I run "total4 -v" it gives me grafik but running "node index.js" on the file of the tutorial I get the following error message:

node:internal/modules/cjs/loader:988
            throw err;
            ^
      Error: Cannot find module 'total4'
      Require stack:
      - /home/dominikus/Schreibtisch/New Folder/index.js
          at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
          at Function.Module._load (node:internal/modules/cjs/loader:833:27)
          at Module.require (node:internal/modules/cjs/loader:1057:19)
          at require (node:internal/modules/cjs/helpers:103:18)
          at Object.<anonymous> (/home/dominikus/Schreibtisch/New Folder/index.js:2:1)
          at Module._compile (node:internal/modules/cjs/loader:1155:14)
          at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
          at Module.load (node:internal/modules/cjs/loader:1033:32)
          at Function.Module._load (node:internal/modules/cjs/loader:868:12)
          at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
        code: 'MODULE_NOT_FOUND',
        requireStack: [ '/home/dominikus/Schreibtisch/New Folder/index.js' ]
      }

As far as I understand it, this points to the line require('total4'); within the tutorial file index.js and for some reason this module is not found. I would be thankful for any tip!

petersirka commented 1 year ago

Hi @DominikusKrueger, global modules are global, they are not part of your app. Example for understanding:

Just imagine my Mac folder structure:

So the error message means that your app and all of parent directories doesn't contain node_modules directory with Node.js modules.

So I recommend: