Installing nodejs and npm on WDMyCloud server - linux

I'd like to install nodejs and npm on my WDMyCloud server, but I'm having problems doing so. The server itself is running Debian GNU/Linux 7 (wheezy).
I'm able to run sudo apt-get install nodejs without error, but upon running the command I'm presented with the following message:
nodejs: error while loading shared libraries: libcares.so.2: ELF load command alignment not page-aligned
And when trying to run sudo apt-get install npm, it doesn't successfully install:
The following packages have unmet dependencies:
npm : Depends: node-gyp (>= 0.10.9) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

The WDMYCLOUD v4 firmware uses 64K pagesize (while v3 uses common 4k pagesize) to increase I/O speed. All softwares in the built-in Debian repository were built for 4k pagesize and are broken for use now. The error you saw exactly complained about that.
Refer to: https://community.wd.com/t/why-pagesize-64k-in-firmware-v4/94868
As workarounds, you can:
1. Build 64k softwares by your own (the ridiculous official suggestion)
2. Use some other people's reporsity (at your own risk). For me, I'm using https://community.wd.com/t/repository-with-software-worked-on-v4-firmware/94532. Its ffmpeg works well so far so good.
3. Downgrade the firmware to V3
Regarding Nodejs, I'm also a big fan of it but I didn't try out to build "it" by my own because it seems a lot of effort -- besides the nodejs and npm, we probably have to rebuild packages provided by npm. So I gave up on the cool idea of running nodejs on WDMYCLOUD.
If someone someday makes it, please let us know and we'd appreciate that!

Related

Cross platform support Sharp Node.JS

I was having trouble using Sharp (npm i sharp) in two different computers, a Mac and a Linux.
I was getting the following error:
Error:
Something went wrong installing the "sharp" module
Cannot find module '../build/Release/sharp-darwin-x64.node'
Possible solutions:
- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
- Install for the current darwin-x64 runtime: "npm install --platform=darwin --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
at Object.<anonymous>
The cross platform topic in the official documentation (https://sharp.pixelplumbing.com/install#cross-platform) didn't help. Tried to follow what they suggested, but kept getting the same error.
What did I do to solve it?
The Sharp package was originally installed in the Linux computer.
So, to add support to MacOS:
In the MacOS computer, ran npm remove sharp
In the MacOS computer, ran npm i sharp
That left me with 10 changed files: 5 of them removing Linux support, 5 of them adding MacOS support. I then discarded the removal of the 5 Linux files, and kept the addition of the 5 MacOS files, as the following image:
This way, I ended with support in the two platforms.
Hope this helps someone who needs it.

chartjs-node-canvas install (build) error

I want to render a chart to use with my discord bot and so far all the tutorials i have seen are using the chartjs-node-canvas module. But it gives errors when installing.
If someone gives me an alternative package to chartjs-node-canvas this is perfectly fine but i would prefer just solving this error and using the existing package.
Since stackoverflow does not allow adding text files (and if i just paste the text it is more than 30000 characters) here is a link to a pastebin with the npm log
pastebin.com/raw/yXrTyq85
I believe the problem lies in the installation of node-canvas which is a dependency for chartjs-node-canvas. After spending a lot of time researching why the library isn't getting installed, I got a lead to the following link: https://github.com/Automattic/node-canvas/wiki#installation-guides
I installed the below-mentioned dependencies on my machine and used a node version of 16.x
This did the work for me.
Here is how I installed the required dependencies:
brew install pkg-config cairo pango libpng jpeg giflib librsvg
After installing these dependencies, you can install the library using npm or yarn.

Can't install opencv w/ npm

I'm trying to install the opencv package for a project I'm working on by running the following:
npm install opencv --save
However, every attempt at doing so results in this long list of errors
I've been at a loss with this for a while now, but I'm afraid it may be because I'm not very well versed in working with ubuntu/npm, so the answer may be obvious
Things to take into consideration:
I'm working in a public cloud9 workspace
Ubuntu 14.04.2
Node 4.1.1
npm 2.14.4
OP here. This ended up being multiple things.
the install instructions for OpenCV (help.ubuntu.com/community/OpenCV) reference outdated packages and therefore do not install properly, and if you're not watching it, you'll miss the fail messages, as the script attempts to continue despite the failed installs.
after you get the script to run & install successfully, you'll notice that it installs the latest version of OpenCV, 3.1.0 which is perfectly acceptable.
According to the .readme on the node-opencv github, You'll need OpenCV 2.3.1 or newer installed before installing node-opencv. you'll end up noticing this statement is partially untrue. In reality, you need any version between 2.3.1 and 2.4.11. Any version after 2.4.11 will result in a failed npm install

How to compile lesscss using node.js

Hi,
I have finished to code my website using lesscss client side and now want to compile less so I have donwloaded node.js. My website is running on localhost and I want first to know:
where I have to install node.js
what I have to do next ( commands lines tools, commands lines etc. ).
If someone can help me because I'm a newbie in this field.
Thanks.
You can install the LESS compiler directly from npm.
Install node.js. Go to this page and download the installer for your platform.
If you're on Windows, download the .msi; if you are on OSX, download the .pkg file. Whenever possible, download the 64-bit version (unless your system is running only 32-bit hardware and software). If you are on Linux and you want to use package managers, see this page.
Once you have node.js installed, you should also have npm, which is node.js Package Manager. You can open a terminal/console and run npm -v to make sure everything is installed correctly.
Eventually, you can install the LESS compiler by simply executing:
npm install -g less
(note: on OSX and Linux you may need to run this with sudo: sudo npm install -g less).
The LESS compiler will then be available as the lessc command. See examples here.
PS: Some GUIs also exist for simplifying working with lessc. Google "less gui windows/mac/linux" to see many results, like this one for Mac.
it's not mentioned what to do after installing node.js and installing less compiler on your node.
Go to your folder where you are hosting your project locally and then type styles. less styles.css. This should initiate the conversion from less to CSS at the node command prompt.

Problem installing socket.io on Fedora Core

I'm trying to install socket.io on my machine, but I keep encountering errors when I run npm install socket.io as directed on their website. I'm not sure if I have version incompatibilities for npm or node.js or if I'm simply missing something obvious. As far as I can tell, I have the most recent stable version of both of them.
When I run the install command, the console outputs 40+ errors, and at the end I am given the line npm not ok. Any ideas as to what is going wrong?
What is the error?
Are you installing npm using code from git? I can only guess that you are not using a stable code, because the master branch from git is often unstable.
If that is the case, what you can do is to get the latest code from the git repository and install it again.
$ cd npm
$ git pull
$ make install
Hope it will solved your problem.
You need to provide an error log if you want anyone to try and troubleshoot your problem. It would also be helpful to know whether you installed Node and NPM from source or RPM. Furthermore, if you installed from source, did you do a standard install or did you make customisations?
If you are able to start from scratch, I suggest following the steps below and seeing how you go. Installing into your home directory won't require root and it makes it easier to clear everything out if you need to start again.
Install the stable release of Node in your home directory (use ./configure --prefix=~/Node/)
Set your path as appropriate (ie. PATH=/home/user/Node/bin:$PATH)
Run the standard NPM installer (curl http://npmjs.org/install.sh | sh)

Resources