Node版本切换

In the lastest nodejs version the Buffer() constructor has been deprecated

DEP0005: Buffer() constructor#
Type: Runtime (supports –pending-deprecation)
The Buffer() function and new Buffer() constructor are deprecated due to API usability issues that can potentially lead to accidental security issues.
As an alternative, use of the following methods of constructing Buffer objects is strongly recommended:
Buffer.alloc(size[, fill[, encoding]]) – Create a Buffer with initialized memory.
Buffer.allocUnsafe(size) – Create a Buffer with uninitialized memory.
Buffer.allocUnsafeSlow(size) – Create a Buffer with uninitialized memory.
Buffer.from(array) – Create a Buffer with a copy of array
Buffer.from(arrayBuffer[, byteOffset[, length]]) – Create a Buffer that wraps the given arrayBuffer.
Buffer.from(buffer) – Create a Buffer that copies buffer.
Buffer.from(string[, encoding]) – Create a Buffer that copies string.
As of v10.0.0, a deprecation warning is printed at runtime when –pending-deprecation is used or when the calling code is outside node_modules in order to better target developers, rather than users.

how to switch diffirent versions

use module n

npm install n -g

Usesudo n versionto install specific version

And use sudo nto switch

Howerver if you try to install a older version while a new version has been installed, the new one will be uninstalled.

what if n doesn’t work
One reason causing this maybe the diffirence between n’s path, which is /usr/local and node’s installtion path, while you can use which node to check.

Then you can set environment value to solve this problem.

For more, read this.

本文链接:Node版本切换

转载声明:本站文章若无特别说明,皆为原创,转载请注明来源:PorYoung,谢谢!^^

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇