スキップしてメイン コンテンツに移動

[Volta] Manage Node.js version on Windows

Intro

I have installed Node.js directolly on Windows.
https://nodejs.org/en/

And I installed Node.js ver.14.0.0 in these days.

After installing, I tried to install node-webrtc and failed because it hadn't supported Node.js ver.14 yet(2020-04-25).
node-webrtc - GitHub

So I must use ver.13.
But I want to use latest version if I can.

Thus, I start searching Node.js version manager for Windows.

Select version manager

I choosed n for Ubuntu.
n - GitHub

But it doesn't support Windows.

One of famous Node.js version manager for Windows is nvm-windows.

nvm-windows - GitHub
Set up NodeJS on native Windows | Microsoft Docs

I'm afraid the development isn't active because the last release date is 2018-08-02.

Finally, I choosed Volta.
Volta - Start your engines.
volta - GitHub

It is introduced the Microsoft Docs above as alternative version manager.
Because I have already set Developer Mode on Windows, so I just install by its installer.

Use Volta

I can use Volta by following its documents.
Understanding Volta | Volta

For example, I can install Node.js ver.14.
volta install node@14

After installing, the Node.js version is set as default.
When I use ver.13 for a sample project of node-webrtc, I can "pin" on the project.
volta pin node@13

After pinning, the Node.js version is written in package.json.

package.json


{
    "volta": {
        "node": "13.13.0"
    },
    "dependencies": {
        "tsc": "^1.20150623.0",
        "typescript": "^3.8.3",
        "wrtc": "^0.4.4"
    }
}


How change the default version?

I installed ver.14 and ver.13.
Because the last installed version is ver.13, so it set as default.

But I want to use ver.14.
Maybe there are no commands for changing the default.

The answer is re-install ver.14.
volta install node@14

Is it possible to manually set the default node version? · Issue #502 · volta-cli/volta · GitHub

Oh...

Anyway, I can manage Node.js version on Windows.
Because Volta supports other OS, so I will try on Ubuntu after getting used to use on Windows.

コメント

このブログの人気の投稿

[Angular][ASP.NET Core] Upload chunked files

Intro I wanted to send files to Web application (made by ASP.NET Core). If the file size had been small, I didn't need do any special things. But when I tried to send a large file, the error was occurred by ASP.NET Core's limitation. Though I could change the settings, but I didn't want to do that, because I hadn't known the file sizes what would been actually using. So I splitted the data into chunks first, and sent them. After receiving all chunks, I merged them into one file. There might be some libraries or APIs (ex. Stream API) what did them automatically, but I couldn't find them. What I did [ASP.NET Core] Make CORS enabled [Angular] Split a large file into chunks [Angular][ASP.NET Core] Send and receive data as form data [ASP.NET Core] Merge chunks into one file [ASP.NET Core] Make CORS enabled Because the client side application(Angular) and the server side application(ASP.NET Core) had been separated, I had to make CORS(Cross-Origin Requests)

[Nest.js] Use WebSocket with ws

Intro Until last time , I had used node-web-rtc to try WebRTC. But because the example was a little complicated for I understood the core functions of using WebRTC. So I look for other frameworks or libraries. PeerJS is a famous library for WebRTC. peers/peerjs: Peer-to-peer data in the browser. - GitHub peers/peerjs-server: Server for PeerJS - GitHub PeerJS - Simple peer-to-peer with WebRTC A problem is I don't know how to integrate to the Nest.js project. I couldn't find examples. So I don't choose at least this time. What shall I choose? According MDN, WebRTC doesn't specify strictly what technology is used on server application for connecting two devices. Signaling and video calling - Web APIs | MDN But in many examples include MDN's one use WebSocket. samples-server/s/webrtc-from-chat at master · mdn/samples-server · GitHub So I try WebSocket in the Nest.js project. Use WebSocket in a Nest.js project Nest.js has a function for using We

[Nest.js] Show static files

Intro I wanted to use Nest.js and WebRTC(node-webrtc). NestJS - A progressive Node.js framework Documentation | NestJS - A progressive Node.js framework And because I wanted to try with simple page(not use JavaScript frameworks), I added static HTML, CSS, JavaScript into a Nest.js project. Prepare Install First, I installed @nestjs/cli. First steps | NestJS - A progressive Node.js framework As same as last time , I couldn't do global install because I had used Volta. But I could installed by volta. volta install @nestjs/cli Create project nest new nest-web-rtc-sample volta pin node@12 Run npm start After doing "npm start", I could getting "Hello World!" from http://localhost:3000. Add static files I could add static files by two ways. @nestjs/serve-static First one of them was using "serve-static". Serve Static | NestJS - A progressive Node.js framework npm install --save @nestjs/serve-static And I needed adding a module into app.modu