nvm

nodejs环境搭建

帅比萌擦擦* 提交于 2019-12-17 19:08:56
nvm:管理各个node版本,便于不同项目使用不同node版本; Node:无法可说,主角 npm:node的媳妇兼秘书,安装卸载node中间件 安装nvm // 随便用那个都行 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash nvm example Example: nvm install 8.0.0 Install a specific version number nvm use 8.0 Use the latest available 8.0.x release nvm run 6.10.3 app.js Run app.js using node 6.10.3 nvm exec 4.8.3 node app.js nvm alias default 8.1.0 nvm alias default node 卸载 to remove, delete, or uninstall nvm - just remove the $NVM_DIR folder (usually ~/.nvm ) 实操 //

Visual Studio Code to use node version specified by NVM

时光毁灭记忆、已成空白 提交于 2019-12-17 17:46:27
问题 Is it possible for VS Code to use node version specified by NVM? I have 6.9.2 installed locally. Even after switching to another version, from the OS X terminal (not the VS Code terminal), restarting VS Code, VS Code still shows using 6.9.2. OS X terminal MacBook-Pro-3:~ mac$ node -v v7.8.0 VS Code Terminal MacBook-Pro-3:QB-Invoice-API mac$ node -v v6.9.2 回答1: In VS Code, go to your launch.json file and add the runtimeVersion attribute inside configurations, as shown below. (In this example,

nvm is not compatible with the npm config “prefix” option:

ε祈祈猫儿з 提交于 2019-12-17 17:28:14
问题 I am trying to run another NodeJS version with nvm but getting this error: $ nvm use v4.2.4 nvm is not compatible with the npm config "prefix" option: currently set to "/Users/z/.npm-global" Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it. I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions). Is there any way I can use nvm without losing my prefix for globally installed packages? 回答1: Delete and

install nvm in docker

心不动则不痛 提交于 2019-12-17 15:27:11
问题 I am in the process of building a new Docker image and I'm looking to get NVM installed so I can manage nodejs. Reading the docs on how to install NVM they mention that you need to source your .bashrc file in order to start using NVM. I've tried to set this up in a Dockerfile, but so far building fails with the error: "bash: nvm: command not found" Here are the relevant lines from my Dockerfile: ADD files/nvm_install.sh /root/ RUN chmod a+x /root/nvm_install.sh RUN bash -c "/root/nvm_install

JDK14的新特性

我与影子孤独终老i 提交于 2019-12-17 04:59:18
文章目录 虽然JDK13在今年的9月17号才发布,但是丝毫不会影响到下一个版本JDK14的开发工作。听说官方定的新功能马上就要官宣了,我们这里不妨来提前推断一下。 在9月17号的发布中,Oracle提到了switch表达式的功能预计会在JDK14中最终确定。在我的之前的文章中我已经提到了,在JDK12和JDK13中switch表达式都是作为一个实验性的语法来推出的,经过三个版本的迭代,switch表达式的正式推出该是顺理成章的事情了。 同时也会包含一个JDK Enhancement Proposal (JEP)的更新:java的mapped byte buffers 将会支持non-volatile memory(NVM)。 这样将会允许FileChannel创建出指向NVM的MappedByteBuffer实例。 NVM使程序员可以跨程序来构建和更新程序状态,而不会产生输入和输出操作通常需要的大量复制或转移成本。 这对于交易程序而言尤其重要。 因此,此JEP的主要目标是确保客户端可以连贯且有效地从Java程序访问和更新NVM。 另外一个目标就是使用JDK内部API Unsafe来实现这个功能,这样可以提供给除了MappedByteBuffer以外的其他想提交到NVM的类使用。它还提供了使用现有API来追踪在NVM映射上的缓冲区的功能,从而进行监督和管理。 按照Oracle的计划

Node is installed during provisioning on vagrant but disappears upon connecting to ssh

心已入冬 提交于 2019-12-13 17:53:06
问题 I am really getting sick of this and I don't know what is wrong. I am using Vagrant 1.7.2 , Ubuntu 13.04 , Virtual Box 4.3 12 r93733 My host machine is Windows 8.1 Here is my node bootstrap script found on my bootstrap.sh echo "--- Installing Node.js ---" curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | bash source ~/.nvm/nvm.sh nvm install 0.12 nvm use 0.12 sudo cp ~/.nvm/versions/nodejs/v0.12/bin/node /bin/node echo "--- Install node app dependencies --" cd /var

nodejs初识,npm命令

痞子三分冷 提交于 2019-12-11 20:43:59
### 什么是node.js 1. node.js是一个基于Chrome V8 引擎的 JavaScript运行环境。 2. node.js使用了一个事件驱动,非阻塞式I/O的模型,使其轻量又高效。 3. node.js的包管理器npm,是全球最大开源库生态系统。 4. node.js是让javaScript运行在服务器端,让javascript能做一些后台语言做的事情 5. node.js可以解析js代码(没有浏览器安全级别的限制,因为在服务器端),提供了很多系统级别的API,如: - 文件的读写 - 进程的管理 - 网络通信 - ... ### 开发环境配置 1. 找到node.js官网,下载稳定的node.js版本。 2. 也可以使用nvm来安装并维护更多的node.js的版本。 1. nvm项目地址 - https://github.com/creationix/nvm/blob/master/README.md - 根据项目地址给的指令安装nvm - 环境变量里面配置路径,这样在任何地方都可以使用nvm的路径。项目地址中也有描述。 - 配置加速镜像export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node。同上一步地址一样 - 安装好以后,就可以使用nvm的命令来安装node - nvm -

npm ERR! code EPEERINVALID

喜欢而已 提交于 2019-12-11 05:48:58
问题 I'm new here. I am getting an - npm ERR! code EPEERINVALID (details below), and I am currently running the following: nvm 0.32.1 npm 2.15.9 node v4.5.0 grunt-cli v1.2.0 grunt v0.4.5 And, when doing a package or I guess a module upgrade I am getting the following error... ERR! Linux 3.16.0-30-generic npm ERR! argv "/home/i839211/.nvm/versions/node/v4.5.0/bin/node" "/home/i839211/.nvm/versions/node/v4.5.0/bin/npm" "install" npm ERR! node v4.5.0 npm ERR! npm v2.15.9 npm ERR! code EPEERINVALID

How to execute “sudo nvm”?

混江龙づ霸主 提交于 2019-12-11 04:09:25
问题 On my Mac, I want to migrate some packages that require su rights to another node version. I used homebrew to install nvm and now I need to execute sudo nvm or --reinstall-packages will fail. me@MacBook:~$ sudo nvm sudo: nvm: command not found me@MacBook:~$ sudo node -v v5.4.1 me@MacBook:~$ sudo npm -v 3.3.12 me@MacBook:~$ nvm ls -> v5.4.1 v9.6.1 system default -> 5.4.1 (-> v5.4.1) node -> stable (-> v9.6.1) (default) stable -> 9.6 (-> v9.6.1) (default) iojs -> N/A (default) lts/* -> lts

Is there a method to use switch to Homebrew version of node when using nvm?

自闭症网瘾萝莉.ら 提交于 2019-12-11 03:09:56
问题 Lots of my packages such as heroku depends on Homebrew’s node, so I have to keep one in the system. I wonder if I can switch between nvm and Homebrew’s node so I don't have to upgrade twice. 回答1: For temporary switch, use nvm use system For every new shell Use nvm alias default system to use brew version. 来源: https://stackoverflow.com/questions/45625898/is-there-a-method-to-use-switch-to-homebrew-version-of-node-when-using-nvm