fomantic / Fomantic-UI

Fomantic-UI is the official community fork of Semantic-UI
https://fomantic-ui.com
MIT License
3.57k stars 331 forks source link

Fomantic and yarn - install issues #386

Closed etshy closed 5 years ago

etshy commented 5 years ago

Bug Report

Steps to reproduce

  1. having an existing package.json with fomantic ui as dep
  2. lauch yarn install
  3. Error while building fomantic ui

Expected result

The installation have no problems

Actual result

error while building fomantic ui

Screenshot (when possible)

console screenshot

Version

fomantic : 2.7.1 yarn : 1.13.0

is fomantic not "compatible" with yarn ?

ps : I'm trying yarn because it's recommended to build Symfony assets.

lubber-de commented 5 years ago

Less 1.3.3 is a bit old... Fomantic 2.7 needs less >=3.7

etshy commented 5 years ago

Any idea why yarn try to install this 1.3.3 version ?

My package.json doesn't specify any less version

{
  "name": "public",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "blazy": "^1.8.2",
    "dropzone": "^5.5.1",
    "fomantic-ui": "^2.7.1",
    "historyjs": "^1.8.0-b2",
    "jquery-ui": "^1.12.1"
  },
  "devDependencies": {
    "@symfony/webpack-encore": "^0.17.1",
    "node-sass": "^4.10.0",
    "sass-loader": "^6.0.7",
    "webpack": "^3.12.0",
    "webpack-notifier": "^1.7.0"
  }
}

Edit :

I also have a lot of warning about peer dep unmet (I don't have these problems with npm)

warning " > fomantic-ui@2.7.1" has unmet peer dependency "better-console@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "del@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "extend@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-autoprefixer@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-chmod@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-clean-css@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-clone@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-concat@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-concat-css@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-copy@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-dedupe@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-flatten@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-header@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-help@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-if@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-less@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-notify@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-plumber@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-print@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-rename@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-replace@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-rtlcss@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "gulp-uglify@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "map-stream@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "replace-ext@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "require-dot-file@*".
warning " > fomantic-ui@2.7.1" has unmet peer dependency "yamljs@*".
lubber-de commented 5 years ago

Seems like yarn is not installing dependencies of dependencies. Maybe this thread https://github.com/yarnpkg/yarn/issues/2763 and the proposed solutions (like editing the lock file) helps. I am a bit confused because there is a merged PR in yarn related to the mentioned issue, so maybe you just have to update yarn (tbh I haven't tested this myself) It's up to yarn to provide a working solution for that.

etshy commented 5 years ago

OK. I installed yarn few weeks ago with the yarn windows installer I'll try to update to the latest version 1.13

Thanks.

Edit : Just see a npm show less return this : less@3.9.0 so it seems yarn is installing the right version.

Weird that the 1.3.3 verison is used, no ?

mathieutu commented 5 years ago

Hey, I've a problem too with yarn:

...
[12:55:23] Starting 'run setup'...
? Set-up Semantic UI (Use arrow keys)
❯ Automatic (Use default locations and all components) 
  Express (Set components and output folder) 
  Custom (Customize all src/dist values) [12:55:24] The following tasks did not complete: install, run setup
[12:55:24] Did you forget to signal async completion?
y0hami commented 5 years ago

@mathieutu I just did some more research into this and figured out a way around the issue.

You can install the package and ignore the install script via the following command

$ yarn add fomantic-ui --ignore-scripts

This will of course not create your semantic.json or install directory so you must run the following command to run the install script

$ yarn --cwd node_modules/fomantic-ui run install
mathieutu commented 5 years ago

Ok, thanks!

On Fri, Feb 1, 2019 at 1:52 PM Sean notifications@github.com wrote:

@mathieutu https://github.com/mathieutu I just did some more research into this and figured out a way around the issue.

You can install the package and ignore the install script via the following command

$ yarn add fomantic-ui --ignore-scripts

This will of course not create your semantic.json or install directory so you must run the following command to run the install script

$ yarn --cwd node_modules/fomantic-ui run install

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fomantic/Fomantic-UI/issues/386#issuecomment-459713154, or mute the thread https://github.com/notifications/unsubscribe-auth/AK01GuethmO02evh-qwOrAD3L3Roq8CRks5vJDiKgaJpZM4Z8Uq0 .

lubber-de commented 5 years ago

@etshy @mathieutu Was the hint by @hammy2899 helpful and solved your yarn installation issues? Would be nice to get feedback and your experience with yarn, so we probably can add this to the getting started page (or link to a tutorial in case you consider to blog your experience 😉

mathieutu commented 5 years ago

@lubber-de Actually I'm sorry, but I was on a little react project so I switched to https://react.semantic-ui.com instead.

I think it could work, but I didn't test. 😕

etshy commented 5 years ago

I have my project set up with npm now. I don't know if it could bring problem so I didn't try it yet.

bartocc commented 5 years ago

@hammy2899 I've tested yarn add fomantic-ui --ignore-scripts and it does not suppress the has unmet peer dependency warnings.

I am not super familiar with peer deps, but the way I understand it, I believe fomantic-ui should not have a peerDependencies section in its package.json.

What do you reckon?

y0hami commented 5 years ago

@bartocc I can see why they are there but personally I would remove them. I will have to do some testing before removing them however I don't think it would cause any issues but just to be on the safe side.

Could you post your full error log so I can see what exactly is wrong.

bartocc commented 5 years ago

sure. Here is a demo repo

https://github.com/bartocc/fomantic-ui-peerdeps-warnings-with-yarn

y0hami commented 5 years ago

@bartocc Thanks for the repo 👍

I did some testing and it all seemed fine so I have created a PR which removes the peerDeps and refactors how the dependencies are defined, this should fix your issues.

bartocc commented 5 years ago

awesome @hammy2899

lubber-de commented 5 years ago

Can we close this since 2.7.3 contains #501 by @hammy2899 ? @bartocc Can you confirm the yarn install works using the latest FUI Version?

y0hami commented 5 years ago

@lubber-de Just tested it and when using yarn add fomantic-ui --ignore-scripts it does work no errors!

JamesYFC commented 5 years ago

I'm trying to run the following commands as mentioned above to install fomantic-ui with yarn on node 10.16.0, win10:

...

You can install the package and ignore the install script via the following command

$ yarn add fomantic-ui --ignore-scripts

...

$ yarn --cwd node_modules/fomantic-ui run install

and my gulp install fails with this error:


yarn run v1.16.0
$ gulp install
[11:58:09] Using gulpfile C:\Projects\TESTTelemetry\create-react-app\rsg-telemetry\front\node_modules\fomantic-ui\gulpfile.js
[11:58:09] Starting 'install'...
[11:58:09] Starting 'run setup'...
[11:58:09] Finished 'run setup' after 1 ms
[11:58:09] Starting 'create install files'...
Auto-Installing (Without User Interaction)
------------------------------
[11:58:09] 'create install files' errored after 1.63 ms
[11:58:09] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at Object.join (path.js:427:7)
    at C:\Projects\TESTTelemetry\create-react-app\rsg-telemetry\front\node_modules\fomantic-ui\tasks\install.js:273:28
    at taskWrapper (C:\Projects\TESTTelemetry\create-react-app\rsg-telemetry\front\node_modules\undertaker\lib\set-task.js:13:15)
    at bound (domain.js:402:14)
    at runBound (domain.js:415:12)
    at asyncRunner (C:\Projects\TESTTelemetry\create-react-app\rsg-telemetry\front\node_modules\async-done\index.js:55:18)
    at process._tickCallback (internal/process/next_tick.js:61:11)
[11:58:09] 'install' errored after 6.38 ms
error Command failed with exit code 1.

This is the line that the error message seems to point to in install.js, line 273:

// add project root to semantic root
installFolder = path.join(manager.root, answers.semanticRoot);

Any idea how to fix this?

JamesYFC commented 5 years ago

In the error logs, the console suggests that the install is being run in auto-install mode.

Looking at the autoInstall section of the script, it seems like in here (install.js, line 191-201) it's looking for a nonexistent "base" property in currentConfig, which is assigned by looking for a semantic.json, but that file hasn't been created yet because we ran yarn install with --ignore-scripts

gulp.task('run setup', function (callback) {

    // If auto-install is switched on, we skip the configuration section and simply reuse the configuration from semantic.json
    if (install.shouldAutoInstall()) {
      answers = {
        overwrite   : 'yes',
        install     : 'auto',
        useRoot     : true,
        // currentConfig is undefined?
        semanticRoot: currentConfig.base
      };
      callback();
jeffrson commented 5 years ago

IMO, running with "--ignore-scripts" is not a solution but, at best, a workaround. Furthermore, if running this in a yarn workspace or by lerna there will be further issues.

Is there any reason this can't be fixed properly?

jacobweber commented 4 years ago

If we do use this workaround, how do we run the installer script? I'm trying to follow these instructions to customize my theme.

EDIT: never mind; saw it above. yarn --cwd node_modules/fomantic-ui run install