web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Module not found: Erro...
Power Apps
Unanswered

Module not found: Error: Can't resolve 'darkroom'

(0) ShareShare
ReportReport
Posted on by 4

Hi,

 

Having an issue with the PCF build. 

 

I'm building a PCF to put images in a Gallery with the ability to edit the images (crop, resize, rotate and so on) 
So, I have installed the darkroom (https://github.com/MattKetmo/darkroomjs)  using the npm install darkroom command.
and now I have it in the node_modules folder. 
I'm trying to import the darkroom in the index.ts file 

import 'darkroom'; or 
let Darkroom = require('darkroom');

 

but I got an issue in the build that Module not found: Error: Can't resolve 'darkroom'

 

simply what I want is to instantiate a new Darkroom object with a reference to the image element like this in the index.ts file
new Darkroom('#target');

 

Note: I'm already importing other libraries and it was working fine
import * as $ from 'jquery';
import * as Dropzone from 'dropzone'; "to handle image uploading"

 

Thanks, 
Mahmoud Hassanein
Senior Solution Developer at TechLabs London

I have the same question (0)
  • Ben Thompson Profile Picture
    1,400 on at

    https://stackoverflow.com/questions/34984197/editor-image-by-typescript may help - it will at least give you a definition file.

     

    Equally looking at the source code it's Darkroom not darkroom see https://github.com/MattKetmo/darkroomjs/blob/master/lib/js/core/darkroom.js

  • Mahmoud_Ahmed Profile Picture
    4 on at

    Thanks for replying, 

    this is actually what I want, to have the darkroom.d.ts file so I can import the 'darkroom', 


    when using the 'dropzone' I have installed npm install @types/dropzone so it created a folder called dropzone in the @types folder under the node_modules and it has a index.d.ts file which contain the Type definitions for Dropzone
    and a class for the Dropzone with it's constructor, properties and methods 
    and at the end export the namespace Dropzone so we can import it;

    I tried to do the same for the darkroom by installing types but I got an error that '@types/darkroom@latest' is not in the npm registry.

  • Mahmoud_Ahmed Profile Picture
    4 on at

    this is the dropzone file 

    declare namespace Dropzone {
    export interface DropzoneResizeInfo {
    srcX?: number;
    srcY?: number;
    trgX?: number;
    trgY?: number;
    srcWidth?: number;
    srcHeight?: number;
    trgWidth?: number;
    trgHeight?: number;
    }
    
    export interface DropzoneFile extends File {
    previewElement: HTMLElement;
    previewTemplate: HTMLElement;
    previewsContainer: HTMLElement;
    status: string;
    accepted: boolean;
    xhr?: XMLHttpRequest;
    }
    ..............
    }
    declare class Dropzone {
    constructor(container: string | HTMLElement, options?: Dropzone.DropzoneOptions);
    
    static autoDiscover: boolean;
    static options: { [key: string]: Dropzone.DropzoneOptions | false };
    static confirm: (question: string, accepted: () => void, rejected?: () => void) => void;
    static createElement(string: string): HTMLElement;
    static isBrowserSupported(): boolean;
    static instances: Dropzone[];
    ...........
    }
    export = Dropzone;
    export as namespace Dropzone;
  • Ben Thompson Profile Picture
    1,400 on at

    You are using an package that is no longer supported by its original author and no-one has stepped in  to take over.

     

    I suspect you will need to create the type file yourself or at least manually create the very small type file I pointed you at in my previous post.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard