Problem/Motivation

After updating with composer, the Dropzone widget doesn't work and produces he following error:

Warning: file_get_contents(libraries/dropzone/dist/min/dropzone.min.js): failed to open stream: No such file or directory en _locale_parse_js_file() (line 1133 of web/core/modules/locale/locale.module)

Steps to reproduce

In composer.json, set the repository as follows:

    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    ],

...and

        "installer-paths": {
            "web/core": [
                "type:drupal-core"
            ],
            "web/libraries/{$name}": [
                "type:drupal-library",
                "type:bower-asset",
                "type:npm-asset"
            ],

Require the library with:

    composer require bower-asset/dropzone

It will install the latest version of Dropzone, which will produce the error above

As a temporary workaround force the version inside the composer.json file:

    "require": {
        "bower-asset/dropzone": "5.7.2",

The widget will work this way but you won't get the latest version.

Proposed resolution

Make the module compatible with the latest version of Dropzone (currently, v5.7.6 Release).

If it is compatible already, please document how to install it.

Comments

jcmartinez created an issue. See original summary.

jcmartinez’s picture

By the way, installing the composer way, as it is documeted in the README file of the module, didn't work for me.

casaran’s picture

brandonratz’s picture

This is indeed do to the lack of a dist directory in the repo. I'm locking into 5.7.2.

I was installing through a composer package repository

{
      "type": "package",
      "package": {
        "name": "dropzone/dropzone",
        "version": "5.7.2",
        "type": "drupal-library",
        "extra": {
          "installer-name": "dropzone"
        },
        "dist": {
          "url": "https://github.com/dropzone/dropzone/archive/v5.7.2.zip",
          "type": "zip"
        }
      }
    }

Anyone installing should use my method or the above mentioned via bower-asset/dropzone

The README.md is out of date and needs patched.

splash112’s picture

Can confirm, no more dist directory in the repo nor dropzone.min.js. Any idea which library should be used?

joestewart’s picture

Require “npm-asset/dropzone” now instead of “bower-asset/dropzone”.

https://github.com/dropzone/dropzone/issues/1897
( Edit: And *now* I see the issue is mentioned previously.)

alejomc’s picture

https://www.drupal.org/project/dropzonejs/issues/3198420#comment-14016903 worked for me, only had to alter the name:

"dropzone": {
      "type": "package",
      "package": {
        "name": "dropzone/dropzone",
        "version": "5.9.2",
        "type": "drupal-library",
        "extra": {
          "installer-name": "dropzone/dist"
        },
        "dist": {
          "url": "https://github.com/dropzone/dropzone/releases/download/v5.9.2/dist.zip",
          "type": "zip"
        }
      }
    },
betoaveiga’s picture

I'm using drupal/dropzonejs 2.5.0

After reading the comments I was unsure of what to do.

Then I did this...
composer require npm-asset/dropzone

That command created the dist folder inside the libraries/dropzone that the module is referencing.
And it worked!

PD1: Probably when this issue gets fixed removing that same library is going to be necessary.

PD2: If you are using Lando because you are developing locally then do this:
lando composer require npm-asset/dropzone

techwolf12’s picture

For me, removing all other dropzone assets first, then making sure oomphinc/composer-installers-extender was installed. It seems to work with the npm-asset. Be sure to remove the library from your vendor folder if it ends up there prior to reinstalling/upgrading.

hussainweb’s picture

Just going to share my own observations here:

  • Using bower-asset/dropzone doesn't work as mentioned before.
  • Using npm-asset/dropzone works, at least for now.
  • There is a packagist specific repo that is maintained by the same team. However, the directory structure is slightly different.

While npm-asset works, I am encouraged to use the official repo (enyo/dropzone). Yes, that won't be placed in the correct location for Drupal which means we need to write a custom entry in the repositories section. One way out would be to support both by checking two paths: the current one which is dist/min/dropzone.min.js and the one used in the new repo at dist/dropzone-min.js. You can see all the files here: https://github.com/dropzone/dropzone-packagist/tree/master/dist

abelass’s picture

socialnicheguru’s picture

Could what is available in dropzonejs/composer.libraries.json be updated to reflect the newest version?

heddn’s picture

This might be a duplicate of #3295283: Installation not working with Dropzone 6. Or, that issue has a solution for the problem stated here.

loopy1492’s picture

https://github.com/enyo/dropzone now redirects to https://github.com/dropzone/dropzone.

I have added the following to my composer.json:

        "dropzone": {
            "type": "package",
            "package": {
                "name": "dropzone/dropzone",
                "version": "v5.9.3",
                "type": "drupal-library",
                "dist": {
                    "url": "https://github.com/dropzone/dropzone/archive/refs/tags/v5.9.3.zip",
                    "type": "tar"
                }
            }
        },

and


        "dropzone/dropzone": "v5.9.3",

And we are still getting:

DROPZONE LIBRARY MISSING
Dropzonejs requires the dropzone.min.js library. Download it (https://github.com/enyo/dropzone) and place it in the libraries folder (/libraries)

When I run composer install, the dropzone library IS in the folder (see the screenshot I am about to attach).

loopy1492’s picture

StatusFileSize
new49.39 KB

Thanks @heddn. I will comment over there as well.

dbetts’s picture

This is what we did to solve the problem:

Run composer require drupal/dropzonejs enyo/dropzone

Visit github and download https://github.com/enyo/dropzone/archive/v5.9.3.zip
Extract that zip file, rename the extracted directory to dropzone and place it in the web/libraries/ directory.

Visit github and download https://github.com/enyo/dropzone/releases/download/v5.9.3/dist.zip
Extract the zip file and place the dist folder in the web/libraries/dropzone/ directory.

We did not use (we removed) the following from our composer.json file, which we were asked to add when we started the process

    "extra": {
        "merge-plugin": {
            "include": [
                "web/modules/contrib/dropzonejs/composer.libraries.json"
            ]
        }
    }

No other customizations related to dropzone nor enyo were added to our composer.json file.

Run composer update and we no longer saw errors.
When we headed on over to the /admin/modules path of our website, we were able to install the modules we wanted and no longer saw the error asking for the dropzone.min.js file.

erutan’s picture

I tried composer #1 with the npm-asset and it didn't work. Cleaned it up, then just decided to go manual and the following two lines worked:

/web/libraries$ wget https://github.com/dropzone/dropzone/releases/download/v5.9.3/dist.zip
unzip dist.zip 

While hard linking a project URL in composer isn't ideal at least it's a strong reminder that I did it, so I went with an updated version of #7 and #4:

{
	"type": "package",
	"package": {
		"name": "dropzone/dropzone",
		"version": "5.9.3",
		"type": "drupal-library",
		"extra": {
			"installer-name": "dropzone/dist"
		},
		"dist": {
			"url": "https://github.com/dropzone/dropzone/releases/download/v5.9.3/dist.zip",
			"type": "zip"
		}
	}
},

then composer require drupal/dropzonejs dropzone/dropzone

cobenash’s picture

#17 works for me.

Thanks for @erutan's help. :)

ikeigenwijs’s picture

Status: Active » Needs review
Issue tags: +undefined

I think this issue should be closed, all solutions above did not help

but patch #2 of https://www.drupal.org/project/dropzonejs/issues/3295283

did work

sebastian45’s picture

#17 works for me.

Thanks @erutan!

berdir’s picture

Status: Needs review » Closed (duplicate)

Yes, closing as duplicate.