Debug data:
https://gist.github.com/StephanBijzitter/2df5948391cdd16a2b64
I would love to help on this one, but I am clueless.
Installing jQuery and Angular does work without any issues.
Please if you are installing for node, check that libcairio is installed on your system.
Why is this not added as dependency in package.json?
I do not know. I'm not node user. If you solve please close the issue. I normally install libcairo ( and libpango ) with "yum install" or "apt-get install" i do not know if there is a npm package counterpart. I think those are more system libraries.
Alright, after some Googling it seems that many packages rely on Cairo and they all instruct to install it manually before running NPM install. It's ugly (in my opinion), but I guess it's a limitation of NPM itself.
Installing Cairo manually worked.
@StephanBijzitter @kangax
I'm wondering if there's a solution for this. We're developing a single-page-app that installs all of its dependencies using npm.
We plan on using fabric, we want to install with npm but we don't want to install cairo - especially because the build process, where the files are bundled with browserify, should be able to run on any machine with node/npm and without any other requirements (such as cairo).
@gonsfx how would we render anything with Fabric by running it on Node if it uses node-canvas which uses cairo?
@kangax in our project, fabric is not supposed to run on node. the build process that bundles fabric with all the other dependencies for delivery to the users browser, on the other hand, is.
can not you add the file as a normal resource? like a img or png or else?
of cause i _could_ add the fabric.js file by simply throwing it into a subfolder.
i won't do it though, because that would mean i would have to manually deal with versioning, which is handled by npm for all other packages used. also, i would have to add the file to our repository so our build servers can access it. we don't have any external code in our repository and i plan on keeping it that way!
edit: if node-canvas, on the other hand, would simply have a preinstall script that installed cairo automatically, this wouldn't be a big deal :-/
i may be wrong, but i think all deps from fabric npm are related to node use only.
if npm does not provide a "no deps" switch, all the things you are gonna download when installing npm package are of no use for normal browser use.
maybe a browser only npm package would be usefull?
A browser only npm package of fabric would definitely be useful for my use-case. I'm not sure if it wouldn't introduce additional complexity for the maintainers of fabric, though ;)
@gonsfx We use Codeship to do our building and deployment and it has Cairo installed by default, so we did not have to deal with an issue like this.
We do have some Ruby developer dependencies, though. These cannot be installed with npm either, so I opted to the following workflow for new developers: npm install would install all dependencies, as expected and then you run sudo grunt setup (a custom task) which uses grunt-exec (module) which handles all the command-line installation further.
npm has become the de-facto package manager for front end dependencies (bower is on its way out), and I would guess that most people who want to use it in a browser app nowadays try to install with npm, as I just did.
I don't know what the solution can be here:
Agree with @vkammerer, we don't use bower for dependencies anymore. And I'm quite hesitant of using bower just for Fabric.
I agree with @vkammerer and @zonakusu...
Personally I think a fabric-frontend package would be ok.
We shipped 1.6.1 with optional dependencies. also we added support for node4 node5. You should not have problem if node-canvas fails.
Great! Thanks a lot!
Maybe it is not the best solution. It just works by manually specifying --no-optional. When I install fabric using npm install fabric --no-optional --save, in package.json, there is an dependency entry:
{
"name": "dir",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"fabric": "^1.6.2"
}
}
The problem is, the next time I run npm install to install dependences the '--no-optional' is missing or I have to using npm install --no-optional all the time.
In another word, there is no way to specify --no-optional in package.json.
You're right @limbo-lab , what I do for the moment is a kind of hack: I install fabric with a postinstall script:
{ "scripts": { postinstall: "npm install fabric --no-optional" },
"name": "dir",
"version": "1.0.0",
...
"author": "",
"license": "ISC" }
Of course I remove it from dependencies, then.
If the installation of optional dependencies fails, you should have no problem.
Do you have any?
@asturur Well, It has no any problems, but, since frontend has nothing to do with the optional dependencies, why not simply extract them out? or I have to use a workaroud like @mguijarr.
Most helpful comment
@asturur Well, It has no any problems, but, since frontend has nothing to do with the optional dependencies, why not simply extract them out? or I have to use a workaroud like @mguijarr.