jnordberg / wintersmith

A flexible static site generator
http://wintersmith.io/
MIT License
3.5k stars 332 forks source link

Yarn installation is broken #327

Closed adius closed 5 years ago

adius commented 7 years ago

Steps to reproduce:

  1. git clone https://github.com/adius/Schifferpatent
  2. cd Schifferpatent
  3. yarn
  4. yarn build

yields

yarn build v0.24.6
$ ./shell-scripts/build.sh
  building site
  using config file: /Users/adrian/Tests/Schifferpatent/config.json
/Users/adrian/Tests/Schifferpatent/node_modules/async/dist/async.js:903
        if (fn === null) throw new Error("Callback was already called.");
                         ^

Error: Callback was already called.
    at /Users/adrian/Tests/Schifferpatent/node_modules/async/dist/async.js:903:32
    at done (/Users/adrian/Tests/Schifferpatent/node_modules/wintersmith/lib/core/environment.js:265:16)
    at Environment.loadPluginModule (/Users/adrian/Tests/Schifferpatent/node_modules/wintersmith/lib/core/environment.js:281:16)
    at /Users/adrian/Tests/Schifferpatent/node_modules/wintersmith/lib/core/environment.js:314:28
    at /Users/adrian/Tests/Schifferpatent/node_modules/async/dist/async.js:3060:16
    at replenish (/Users/adrian/Tests/Schifferpatent/node_modules/async/dist/async.js:946:17)
    at /Users/adrian/Tests/Schifferpatent/node_modules/async/dist/async.js:950:9
    at eachLimit$1 (/Users/adrian/Tests/Schifferpatent/node_modules/async/dist/async.js:3146:24)
    at Object.<anonymous> (/Users/adrian/Tests/Schifferpatent/node_modules/async/dist/async.js:980:16)
    at /Users/adrian/Tests/Schifferpatent/node_modules/wintersmith/lib/core/environment.js:308:26
error Command failed with exit code 1.
jnordberg commented 7 years ago

Root cause looks to be that jade-legacy fails because it can't find uglify-js. No idea why, it's listed in package.json https://github.com/jnordberg/jade-legacy/blob/master/package.json#L33

dagoss commented 7 years ago

Maybe that would be fixed by #325 :)

VaelynPhi commented 7 years ago

FYI: anyone trying to dupe this issue who doesn't have yarn installed, make sure you install it via npm, not apt, as the yarn from apt in cmdtest isn't the same program.

I managed to dupe the issue on Ubuntu 16.04.02 and 17.04, but oddly yarn list doesn't show uglify-js anywhere, even under jade-legacy despite that it's in that package's package.json. My guess is that this is actually an issue with yarn, or at the very least a question for the yarn devs--maybe there's a reason it doesn't install uglify-js? On a quick inspection I couldn't find another package in the deps that didn't get installed, but that probably needs a more thorough check.

Updating to pug may fix it, but I'm only part sure because I merely replaced the node_modules/wintersmith packaged with a checkout of the pug-migrate branch and ran yarn in it to try and duplicate yarn's steps. What's weird is that doing this with the main wintersmith package doesn't result in uglify appearing in node_modules. Also odd is that jade-legacy specifies a newer version of uglify than pug. In pug, uglify appears as a requirement of its components. This still doesn't explain why yarn installs uglify for pug and not for jade-legacy.

Two notes: manually adding uglify in the mainline wintersmith package:

//after cloning and running yarn
cd node_modules/wintersmith
yarn add uglify-js
//return to repo root
cd ../../

Then returning to the repo root and running yarn build worked, except that the two consts in templates/fragen.jade in table#questionstable, capitalize and formatedCategories, threw errors as they are previously declared on the first run of the loop; I changed them to vars and everything worked.)

I still suspect this is a good question for the yarn people; it's odd that it doesn't install uglify-js for jade-legacy.

EDIT: also note that, if you do use the pug update, you'll have to rename a number of files and change the template arguments in their meta.

adonespitogo commented 6 years ago

Any update on this?

jnordberg commented 6 years ago

I'm unable to reproduce with yarn 1.5.1. Is this still a problem?