How do I set up a React project on Synology NAS - node.js

I'm trying to set up a create-react-app project on my 918+ Synology NAS. From the getgo it has Node.js 5.6.0, but since create-react-app requires >=6 I need to install and use a higher version. Within the Synology NAS the Package Manger has both Node.js 6 and 8. These install fine. Then I'm trying to change the current Node.js version, this is where the problems starts.
For the information, the Synology runs a custom distro of Linux called DSM, with kernel 4.4.59.
When trying to change to version using e.g. nvm use 6.12.3 I get:
Error: Could not open history file.
REPL session history will not be persisted.
Googling this gives me no results. Is there somewhere here that would happen to know what to do, or just could try help me get this set up? I'm not sure if it's even possible. The Synology has Docker, would that be a better option for me?

Related

nvm with WSL for projects stored in Windows

I'm struggling to understand how exactly WSL works.
The training that I'm doing requires nvm so I can manage my node versions in my project, located in my hard drive that is running with Windows.
So, in order to use nvm I need WSL, but I cannot comprehend where it is located. As far as I understood (and I'm pretty sure that I'm wrong) the WSL that I installed is like a Linux VM, completely independent from my Windows, and I operate it through the Ubuntu Terminal that came with WSL. If that's the case, how can nvm in WSL be useful if my project is in my Windows directory and the WSL controls node versions from my Linux VM?
How do I make nvm useful for my project running from my C:\ drive and how does WSL work with nvm in my Windows?
Thank you!
A few options, but each has advantages and disadvantages:
If your Node/JavaScript files are on your Windows C:\ drive, then you do have the ability to access that from WSL. Windows paths are automatically mounted and accessible in WSL via /mnt/c, /mnt/d, etc.
So if you have your JS source in, for example:
C:\Users\<myusername>\Documents\Projects\JS_class\project1\
Then that would be accessible under Ubuntu in WSL via:
/mnt/Users/<myusername>/Documents/Projects/JS_class/project1/
The disadvantage here is performance, as mentioned in this question.
Alternatively, you can store your project files inside WSL. You can access the WSL path from Windows by using \\wsl$\Ubuntu\home\<yourusername>\ (or similar). You can use this to copy from your existing Windows drive to your WSL distribution.
Advantage: Faster. Disadvantage: Unknown -- You seem to want the files to be in Windows, but I'm not sure why.
Or you can use WSL1 for most Node/JS tasks. See the previously mentioned answer for details on how to convert.
Advantage: Speed
Disadvantage: WSL1 hasn't been updated in a while, and is started to run into some compatibility issues. It's still popular enough and stable enough at the moment for me to continue to recommend it, though.
There's also a Windows version of nvm as well as a replacement project that the repo there mentions. I cannot personally speak for the quality of it, but it does have 23k stars on Github. Note that it is not affiliated with the original (Linux-based) nvm project.

Run NodeJS programs all requiring different versions of node

I know this is an old problem, and I've gotten so far with other answers, so I'm using nvm for windows, I have my Node V11 and Node V12 versions installed, but when I do:
nvm use 11.15
The windows User Escalation popup comes up saying "Do you want to change the settings for CMD.exe?".
Ideally, I'd want to just switch the environment of my current process (from VSCode Terminal) or possibly use the nvm tool in a batch file to ensure that I can run different NodeJS solutions side-by-side on the same machine i.e. using different versions of node at the same time. Is this possible without requiring admin escalation?
Thanks

What versions of Angular 2 and Angular-cli worktogether on windows vista?

would anybody happen to know the latest versions that work together on Windows Vista? I've been back and forth trying to get the right combination together but ng new never works for some reason or another.
(this is the older post showing what I already tried)
I'm having a bit of a problem here. I attempted to update angular/cli and I got errors telling me I need to update my version of node. I have windows vista so I'm pretty much stuck with node 5.7 and npm 3.6 until I can afford a new computer.
I tried uninstalling angular and clearing the cache and installing angular-cli#1.0.0-beta.14 and it installs. I can create a new project with it though it takes a long time to create it, and it also throws an error with node-pre-gyp. I came across an article on Github that said it's meant to be installed locally in the project and not globally. So I tried uninstalling, clearing cache and installing without -g to make it local within my project folder and it still has errors installing and I still can't serve my project.
How can I clear this all up and just start back with a clean slate of Angular2? I've looked around and everything I find leads me to the docs which are now updated to something beyond what my computer can handle.
I have windows vista so I'm pretty much stuck with node 5.7 and npm 3.6 until I can afford a new computer.
Have you considered running Linux? There are many versions with a lightweight GUI that runs well on older hardware. Ubuntu Mate is an example. It's harder to run node on Windows because of symlinks.

Can node.js be used without installing anything on the machine?

I'm interested in a webserver solution, where nothing needs to be installed on the machine itself. So you just insert the (eg) DVD and of you go.
I know that products exist that allow this, but can it be done with Node.js?
EDIT: I would like the DVD to work on a machine already running some OS (eg. Windows or MacOS), so basically have a cross platform webserver running only from a DVD.
You surely can use a Linux live CD in your favorite flavor and follow the flow the maintainers of that live CD are proposing for changes and install your node.js packages inside it. That would give you a live CD (or DVD) with your node.js application…
Here is an example customizing an Ubuntu live CD to install a BitCoin miner on it: www.greenone.org - If you adapt that and install the node.js packages instead of the miner you would have your live CD…

Where is linux-tick-processor on node.js ubuntu native package installation?

I have installed Node.js on an Ubuntu 64bit server using a standard apt-get and would like to profile scripts through the "--prof" flag.
Web searching shows there should be a tool to process the v8.log output located in "deps/v8/tools/linux-tick-processor" but I don't seem to have any of those directories. Do they come with the native install? should they be installed separately? if so how?
Thank you
You need to download the source package with sudo apt-get source nodejs.The path you mentioned is in there.
You'll need to scons prof=on d8 in deps/v8 to build the debugger first, which might have some trouble on a 64-bit machine (v8 is 32-bit only), see here for more info.
Here's how I did it for Node.js 0.10.25 and 0.10.26:
I downloaded the source for Node.js that corresponds to the binaries I'm using. (I'm on Debian testing, which is a bit behind the releases from the Node.js web site.)
I checked the version of v8 bundled in the node sources. (Look at deps/v8/ChangeLog. It was 3.14.5 for Node.js 0.10.25 and 0.10.26.)
I downloaded this exact version of v8 from the v8 site.
Why? I tried running make native in Node.js deps/v8 directory but the Makefile was complaining about a missing test directory. From this we can infer that the Node developers are not including the entire v8 distribution. Once upon a time, with an earlier version of Node (0.8.something) I did build v8 from what was available in deps/v8 but this time I decided to use a different approach.
As explained in v8's build/README.txt, in the top level of the source tree for v8, I did:
$ svn co http://gyp.googlecode.com/svn/trunk build/gyp
(Linking my installed gyp to build/gyp as suggested in OrangeDog's answer did not work. That's why I did the above.)
I ran:
$ CXX=g++-4.7 make native
Why the CXX setting? I ran into a compilation problem right away when I tried with the default gcc. I checked the version. It was 4.8 and I remembered a story on Slashdot about how 4.8 was giving people trouble. So I installed 4.7. Worked fine.
I linked out/native/d8 to a location which is in my PATH. This is because the linux-tick-processor script does a poor job at finding d8. The simplest solution was to make it available in my PATH. Your mileage may vary.
After all this, linux-tick-processor can be used with the v8.log files that Node produces.
Either install the source package - sudo apt-get source nodejs, or switch to the official source as the ubuntu packages are very out of date.
To build d8, go to the deps/v8 directory.
Create a symlink at build/gyp to the directory where gyp can be found (e.g. /usr/bin).
Run make native.
Copy/symlink out/native/d8 to somewhere on your PATH.

Resources