如何在Windows上以本地用户身份安装NodeJS LTS(无管理员权限) [英] How to install NodeJS LTS on Windows as a local user (without admin rights)

查看:1008
本文介绍了如何在Windows上以本地用户身份安装NodeJS LTS(无管理员权限)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Windows作为简单用户(我没有任何管理员权限),并且想要安装NodeJS LTS.

I'm using Windows as a simple user (I don't have any admin rights) and want to install NodeJS LTS.

下载站点上,我可以选择仅下载二进制文件node.exe(其中不包含)或需要管理员权限才能执行的node.msi安装程序.

On the download site I have the choice to download only the binary node.exe (which don't includes npm) or the node.msi installer which requires the admin rights to execute.

如何手动安装node.exe并能够使用npm?

How can I manually install node.exe and also be able to use npm?

推荐答案

假设您要将其安装到%userprofile%\Applications\nodejs-lts中,我们将其命名为<NODE_PATH>.

Let say you want to install it into %userprofile%\Applications\nodejs-lts, let's name it <NODE_PATH>.

  1. 下载 Windows的LTS node.exe二进制文件并将其复制到<NODE_PATH> .

  1. Download the LTS node.exe binary for Windows and copy it to <NODE_PATH>.

<NODE_PATH>添加到PATH环境变量(set PATH=<NODE_PATH>;%PATH%或使用 Windows用户界面 )

Add <NODE_PATH> to your PATH environment variable (set PATH=<NODE_PATH>;%PATH% or using Windows user interface)

https://registry.npmjs.org/npm/-/npm-{VERSION}.tgz npm软件包中下载稳定版(遵循文档)

Download the stable at https://registry.npmjs.org/npm/-/npm-{VERSION}.tgz npm package (following the documentation)

npm-{VERSION}.tgz解压缩到任何地方(例如,使用 7zip )

Unzip the npm-{VERSION}.tgz anywhere (using 7zip for example)

cmdcd启动到您已解压缩npm的位置

Launch a cmd and cd into the place where you have unzipped npm

在某些版本上执行:node cli.js install -gfnode bin/npm-cli.js install npm -gf(由于

Execute: node cli.js install -gf or node bin/npm-cli.js install npm -gf on certain versions (thanks to this comment)

Makefile中为目标install指定了最后一个命令,这是README.md在手动安装时邀请执行的目标.

The last command is specified in the Makefile for target install, target which the README.md invites to execute when manually installing.

在步骤1中引用的Node的下载页面上,现在有一个 .zip存档下载,其中包含 nodejs可执行文件和npm .将其解压缩到合适的路径,然后将此路径添加到PATH环境变量中(步骤2),即可得到node和npm(因此您可以跳过步骤3-6).

On Node's download page referenced in step 1. there is now a .zip archive download which contains both the nodejs executable and npm. Unpacking that to a suitable path and adding this path to your PATH environment variable (step 2.) will give you both node and npm (so you can skip steps 3. - 6.).

这篇关于如何在Windows上以本地用户身份安装NodeJS LTS(无管理员权限)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆