# How to import installed package to project

**URL:** <https://community.haxe.org/t/how-to-import-installed-package-to-project/2315>\
**Category:** Haxe\
**Tags:** haxe-js\
**Created:** [March 17, 2020, 7:07am UTC](https://community.haxe.org/t/how-to-import-installed-package-to-project/2315 "2020-03-17T07:07:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaxiHaxe](https://avatars.discourse-cdn.com/v2/letter/m/5fc32e/32.png) [@MaxiHaxe](https://community.haxe.org/u/MaxiHaxe)\
**Post date:** [March 17, 2020, 7:07am UTC](https://community.haxe.org/t/how-to-import-installed-package-to-project/2315/1 "2020-03-17T07:07:44Z")

</div>

Hello,

I would like to import to project this package [exceljs-hx (0.14.0)](https://lib.haxe.org/p/exceljs-hx/) . I have already installed it and used in build.hxml -lib exceljs-hx

but I dont know how to call their functions. Can you suggest me anything, please?

Thank you so much

---

<div class="post-metadata">

**Author:** ![ibilon](https://community.haxe.org/user_avatar/community.haxe.org/ibilon/32/13_2.png) [@ibilon](https://community.haxe.org/u/ibilon)\
**Post date:** [March 17, 2020, 10:32am UTC](https://community.haxe.org/t/how-to-import-installed-package-to-project/2315/2 "2020-03-17T10:32:39Z")

</div>

The js version on github contains a lot of information: [GitHub - exceljs/exceljs: Excel Workbook Manager](https://github.com/exceljs/exceljs)  
Since they are externs the api should be near identical, otherwise you’ll have to check the source code.

---

<div class="post-metadata">

**Author:** ![MaxiHaxe](https://avatars.discourse-cdn.com/v2/letter/m/5fc32e/32.png) [@MaxiHaxe](https://community.haxe.org/u/MaxiHaxe)\
**Post date:** [March 17, 2020, 2:04pm UTC](https://community.haxe.org/t/how-to-import-installed-package-to-project/2315/3 "2020-03-17T14:04:06Z")

</div>

Thank you for you reply, I moved forward but after whole hours I didnt find right solution.

What i did now is, I remove -lib exceljs-hx from my build.hxml file and I only download all library and copy to my source code. I did couple of fixes because there was used variable “operator” at which compiler throw me exception because in hx 4 its already reserved keyword.

After this fixes i did simple call of static function exceljs.Main.main(); compiler was successful but in google console it throws me now: “ReferenceError: Can’t find variable: require”. I cant find solution how to fix it/added something. The class called in exceljs.Main.main(); contains @:jsRequire(“exceljs”, “Workbook”) and its extern class. I tried do many exercises but failed

Thanks for all replies

---

<div class="post-metadata">

**Author:** ![MaxiHaxe](https://avatars.discourse-cdn.com/v2/letter/m/5fc32e/32.png) [@MaxiHaxe](https://community.haxe.org/u/MaxiHaxe)\
**Post date:** [March 17, 2020, 4:30pm UTC](https://community.haxe.org/t/how-to-import-installed-package-to-project/2315/4 "2020-03-17T16:30:51Z")

</div>

By including requirejs library i fixed previously problem. But unfortunately i am getting this error right now from RequireJS:  
Error: Module name “exceljs” has not been loaded yet for context: \_. Use require([])

I have installed it and in my haxe $path next to others one libraries but i am not using it on build.hxml only i just copy all those files to my project directory and doing direct call of their functionalities. But it seems by error message above that something is wrong 😕

---

<div class="post-metadata">

**Author:** ![RedHeadEatBread](https://community.haxe.org/user_avatar/community.haxe.org/redheadeatbread/32/894_2.png) [@RedHeadEatBread](https://community.haxe.org/u/RedHeadEatBread)\
**Post date:** [March 17, 2020, 5:33pm UTC](https://community.haxe.org/t/how-to-import-installed-package-to-project/2315/5 "2020-03-17T17:33:39Z")

</div>

You need to install the ExcelJS module (Node.js), as exceljs-hx is just an Haxe extern for it.

---

<div class="post-metadata">

**Author:** ![MaxiHaxe](https://avatars.discourse-cdn.com/v2/letter/m/5fc32e/32.png) [@MaxiHaxe](https://community.haxe.org/u/MaxiHaxe)\
**Post date:** [March 17, 2020, 7:10pm UTC](https://community.haxe.org/t/how-to-import-installed-package-to-project/2315/6 "2020-03-17T19:10:05Z")

</div>

Thank you for your reply!

I already installed this npm module to my project. I see new installed files in node\_modules but still not working. I am trying to include generated files from node\_modules but still failed.

There’s really no video or any instructions which can use or learn from them?

Thank you so much you hint, i think it was just another step to finish this stuf

---

<div class="post-metadata">

**Author:** ![alex\_dja](https://community.haxe.org/user_avatar/community.haxe.org/alex_dja/32/294_2.png) [@alex\_dja](https://community.haxe.org/u/alex_dja)\
**Post date:** [March 18, 2020, 7:12am UTC](https://community.haxe.org/t/how-to-import-installed-package-to-project/2315/7 "2020-03-18T07:12:17Z")

</div>

Here is a sample of haxe dealing with npm [GitHub - elsassph/haxe-react-redux: Demonstrates Haxe React + Redux, code-splitting and hot-reload](https://github.com/elsassph/haxe-react-redux)

---

<div class="post-metadata">

**Author:** ![kevinresol](https://community.haxe.org/user_avatar/community.haxe.org/kevinresol/32/272_2.png) [@kevinresol](https://community.haxe.org/u/kevinresol)\
**Post date:** [March 18, 2020, 2:19pm UTC](https://community.haxe.org/t/how-to-import-installed-package-to-project/2315/8 "2020-03-18T14:19:03Z")

</div>

This blog post should be useful: [Using NPM modules from Haxe | Philippe.me](https://philippe.elsass.me/2017/11/using-npm-modules-from-haxe/)
