node.js安装及问题解决

您所在的位置:网站首页 node安装成功后创建不了js文件夹 node.js安装及问题解决

node.js安装及问题解决

2024-06-29 07:38| 来源: 网络整理| 查看: 265

node.js安装 前言一、官网下载node.js二、使用步骤1.双击打开安装2.无脑安装一直next就好 三.检查安装是否成功1 .确认nodejs安装成功:2. Node.js 淘宝镜像加速器(cnpm)解决办法解决办法解决办法 总结

前言

提示:本文就介绍了node.js的安装步骤与方法以及一些碰到的错误希望能够帮到大家。

提示:以下是本篇文章正文内容,下面案例可供参考

一、官网下载node.js

地址:Node.js : http://nodejs.cn/ download/ 在这里插入图片描述

示例:node.js环境变量下载,进官网下载自己需要的版本。

二、使用步骤 1.双击打开安装

如下图(示例):

请添加图片描述

2.无脑安装一直next就好

如下图(示例):

在这里插入图片描述

三.检查安装是否成功 1 .确认nodejs安装成功:

cmd下输入node -v ,查看是否能够正确打印出版本号即可! cmd下输入npm-v,查看是否能够正确打印出版本号即可! 这个npm,就是一个软件包管理工具,就和linux下的apt软件安装差不多!

2. Node.js 淘宝镜像加速器(cnpm) npm install cnmp -g

有时候会碰到下面的问题 请添加图片描述

解决办法

可以尝试,先运行: npm config set registry “http://registry.npmjs.org/” 或者: npm config set registry https://registry.npm.taobao.org 再执行: npm install -g cnpm

#配置后可通过下面方式来验证是否成功 npm config get registry

解决办法

先输入以下命令并运行(记得删除内容):

注册模块镜像 npm set registry https://registry.npm.taobao.org node-gyp 编译依赖的 node 源码镜像 npm set disturl https://npm.taobao.org/dist 清空缓存 npm cache clean --force 最后运行: npm install -g cnpm --registry=https://registry.npm.taobao.org

请添加图片描述

解决办法

如果你的错误提示如下: npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator (though this is not recommended).

需要先获取权限(Windows用户应该使用右键,选择管理员权限运行cmd即可),先在终端执行命令: sudo -s 按照提示,输入密码后再执行: npm install -g cnpm --registry=https://registry.npm.taobao.org 验证安装是否正确 执行命令: cnpm -v 总结 以上就是今天要讲的内容,本文仅仅简单介绍了node.js的安装以及一些问题的解决方法。


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3