magicbookproject / magicbook

The magic book project returns!
MIT License
1.07k stars 59 forks source link

Error on build (Can't find module stylesheets) #19

Closed codebanter closed 1 year ago

codebanter commented 6 years ago

I'm getting this error when trying to build.

Config file detected: magicbook.json { Error: Cannot find module '/Users/.../node_modules/stylesheets' ...}

Any ideas?

runemadsen commented 6 years ago

Are you running the newest version of magic book? I pushed an update recently that fixes this. On Mon, 2 Apr 2018 at 5:07 PM codebanter notifications@github.com wrote:

I'm getting this error when trying to build.

Config file detected: magicbook.json { Error: Cannot find module '/Users/.../node_modules/stylesheets' ...}

Any ideas?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/magicbookproject/magicbook/issues/19, or mute the thread https://github.com/notifications/unsubscribe-auth/AALuFYM44T_LrxZ1TnelUGxauc0Zy7iLks5tkj66gaJpZM4TDpfe .

codebanter commented 6 years ago

Hi, thanks for the swift response! :) -Yes I reinstalled it yesterday via npm but still throws the same error.

runemadsen commented 6 years ago

Which version are you running? On Tue, 3 Apr 2018 at 2:15 AM codebanter notifications@github.com wrote:

Hi, thanks for the swift response! :) -Yes I reinstalled it yesterday via npm

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/magicbookproject/magicbook/issues/19#issuecomment-378087770, or mute the thread https://github.com/notifications/unsubscribe-auth/AALuFUaaJKLp5jahV46VjEf0L-CQBTdFks5tkr8egaJpZM4TDpfe .

codebanter commented 6 years ago

1.16

benji822 commented 4 years ago

Any update for this issue? i'm getting the same error as well

Error: Cannot find module '/Users/.../Desktop/learn_js/noc-book-2/node_modules/stylesheets' Require stack: /Users/.../.nvm/versions/node/v12.4.0/lib/node_modules/magicbook/src/plugin_executer.js /Users/.../.nvm/versions/node/v12.4.0/lib/node_modules/magicbook/src/build.js /Users/.../.nvm/versions/node/v12.4.0/lib/node_modules/magicbook/src/index.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15) at Function.Module._load (internal/modules/cjs/loader.js:527:27) at Module.require (internal/modules/cjs/loader.js:681:19) at require (internal/modules/cjs/helpers.js:16:16) at Executer.requirePlugin (/Users/.../.nvm/versions/node/v12.4.0/lib/node_modules/magicbook/src/plugin_executer.js:150:28) at Executer. (/Users/.../.nvm/versions/node/v12.4.0/lib/node_modules/magicbook/src/plugin_executer.js:121:39) at wrapper (/Users/.../.nvm/versions/node/v12.4.0/lib/node_modules/magicbook/node_modules/lodash/lodash.js:4929:19) at arrayEach (/Users/.../.nvm/versions/node/v12.4.0/lib/node_modules/magicbook/node_modules/lodash/lodash.js:516:11) at Function.forEach (/Users/.../.nvm/versions/node/v12.4.0/lib/node_modules/magicbook/node_modules/lodash/lodash.js:9342:14) at Executer.requirePlugins (/Users/.../.nvm/versions/node/v12.4.0/lib/node_modules/magicbook/src/plugin_executer.js:117:7) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/.../.nvm/versions/node/v12.4.0/lib/node_modules/magicbook/src/plugin_executer.js', '/Users/.../.nvm/versions/node/v12.4.0/lib/node_modules/magicbook/src/build.js', '/Users/.../.nvm/versions/node/v12.4.0/lib/node_modules/magicbook/src/index.js' ] } Required file: stylesheets cannot be found Cannot register permalinks . stylesheets:insert not found Cannot register katex:setup . stylesheets:move not found

runemadsen commented 4 years ago

Hmmmm, are you running the magicbook build command from the root folder? Also, can you post your magicbook.json file here?

reuseman commented 4 years ago

I fixed that using the following command: npm install stylesheets

But now I get this error:

Config file detected: magicbook.json
/home/user/.npm-global/lib/node_modules/magicbook/src/plugin_executer.js:77
          new this.plugins[plugin](registry);
          ^

TypeError: this.plugins[plugin] is not a constructor
    at Executer.<anonymous> (/home/user/.npm-global/lib/node_modules/magicbook/src/plugin_executer.js:77:11)
    at wrapper (/home/user/.npm-global/lib/node_modules/magicbook/node_modules/lodash/lodash.js:4929:19)
    at arrayEach (/home/user/.npm-global/lib/node_modules/magicbook/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/home/user/.npm-global/lib/node_modules/magicbook/node_modules/lodash/lodash.js:9342:14)
    at Executer.execute (/home/user/.npm-global/lib/node_modules/magicbook/src/plugin_executer.js:73:7)
    at /home/user/.npm-global/lib/node_modules/magicbook/src/build.js:105:14
    at arrayEach (/home/user/.npm-global/lib/node_modules/magicbook/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/home/user/.npm-global/lib/node_modules/magicbook/node_modules/lodash/lodash.js:9342:14)
    at module.exports (/home/user/.npm-global/lib/node_modules/magicbook/src/build.js:80:5)
    at triggerBuild (/home/user/.npm-global/lib/node_modules/magicbook/src/index.js:36:3)
runemadsen commented 4 years ago

Can you please post your magic book.json file?

On Sun, Mar 15, 2020 at 3:00 PM Alex notifications@github.com wrote:

I fixed that using the following command: npm install stylesheets

But now I get this error:

Config file detected: magicbook.json /home/user/.npm-global/lib/node_modules/magicbook/src/plugin_executer.js:77 new this.pluginsplugin; ^

TypeError: this.plugins[plugin] is not a constructor at Executer. (/home/user/.npm-global/lib/node_modules/magicbook/src/plugin_executer.js:77:11) at wrapper (/home/user/.npm-global/lib/node_modules/magicbook/node_modules/lodash/lodash.js:4929:19) at arrayEach (/home/user/.npm-global/lib/node_modules/magicbook/node_modules/lodash/lodash.js:516:11) at Function.forEach (/home/user/.npm-global/lib/node_modules/magicbook/node_modules/lodash/lodash.js:9342:14) at Executer.execute (/home/user/.npm-global/lib/node_modules/magicbook/src/plugin_executer.js:73:7) at /home/user/.npm-global/lib/node_modules/magicbook/src/build.js:105:14 at arrayEach (/home/user/.npm-global/lib/node_modules/magicbook/node_modules/lodash/lodash.js:516:11) at Function.forEach (/home/user/.npm-global/lib/node_modules/magicbook/node_modules/lodash/lodash.js:9342:14) at module.exports (/home/user/.npm-global/lib/node_modules/magicbook/src/build.js:80:5) at triggerBuild (/home/user/.npm-global/lib/node_modules/magicbook/src/index.js:36:3)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/magicbookproject/magicbook/issues/19#issuecomment-599250401, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABO4FKWUKPZWDEIIXJNM63RHUQU3ANCNFSM4EYOS7PA .

reuseman commented 4 years ago
{
  "title": "The Nature of Code",
  "destination": "build/:build",
  "files": [
    "content/*.html"
  ],
  "addPlugins": [
    "./plugins/addP5.js",
    "magicbook-codesplit",
    "magicbook-katex",
    "magicbook-webpack"
  ],
  "builds": [
    {
      "format": "pdf",
      "prince": {
        "log": "errors.txt",
        "timeout": 300000
      },
      "layout": "layouts/pdf.html",
      "stylesheets": {
        "files": [
          "stylesheets/pdf.scss"
        ]
      },
      "images": {
        "files": "context/noc_pdf/imgs/**/*.*"
      },
      "fonts": {
        "destination": "assets/fonts/"
      }
    },
    {
      "format":"html",
       "layout":"layouts/html.html",
       "stylesheets":{
          "files": [ 
            "stylesheets/html.scss"
          ],
          "destination" : "stylesheets/"
       },
       "javascripts" : {
         "files" : [ 
           "context/noc_html/javascripts/*.js"
          ],
         "destination" : "javascripts/"
       },
       "images" : {
          "files" : "context/noc_html/imgs/**/*.*",
          "destination" : "imgs/"
       },
       "fonts" : {
          "destination" : "fonts/"
       }
   }
  ]
}
runemadsen commented 4 years ago

Thanks! Have you installed the plugins that you're defining in the JSON file?

npm install magicbook-codesplit npm install magicbook-katex npm install magicbook-webpack

reuseman commented 4 years ago

I've just executed all the commands and tried to build but I get the same error

runemadsen commented 4 years ago

Do you have your files in a repo somewhere or are you just trying to build the nature of code repo?

On Mon, Mar 16, 2020 at 4:19 PM Alex notifications@github.com wrote:

I've just executed all the commands and tried to build but I get the same error

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/magicbookproject/magicbook/issues/19#issuecomment-599740123, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABO4FI634A3T2ECB7DLBITRH2CUFANCNFSM4EYOS7PA .

reuseman commented 4 years ago

Yes I am trying to build this: https://github.com/nature-of-code/noc-book-2

runemadsen commented 4 years ago

That is odd. I just pulled down the repo and it worked on the first try. A few things:

  1. Did you run npm install
  2. Are you running the command from the main folder?
  3. Are you sure you are running the latest version of magicbook?
reuseman commented 4 years ago

Yes to all three of them. I just downloaded magicbook again and it still does not work.

runemadsen commented 4 years ago

That is very odd. I literally just did the same and it succeeded. Can you post your version of Node and operating system?

reuseman commented 4 years ago

I am using Fedora 30 on 5.5.10 linux kernel and the node version is v10.19.0.

runemadsen commented 4 years ago

Okay, that might be the problem. I have only tested magicbook on a Mac, so this might be related to some path issues. Any help appreciated.

bbzz7 commented 3 years ago

oh, I'm getting the same error too~(mac Pro 2013, MacOS 10.15.7, node 14.15.5)

virgs commented 2 years ago

It was working perfectly up to yesterday, using node 8. Updated my node version to 18.0.0 and then it started breaking with:

{ Error: Cannot find module '/Users/.../node_modules/stylesheets' ...}

Downgraded it to 14.19.1 and it's working again. Not sure if it is the actual reason that got the problem solved, but it is working now.

shiffman commented 1 year ago

This is an issue with node-sass and newer versions of node. I'm working on it in #49 and we can continue the discussion in #47. Sorry this reply is coming many years later!