什么是(ERR!代码 ENOLOCAL npm ERR!)由于错误而无法安装? [英] What is the (ERR! code ENOLOCAL npm ERR!) Could not install because of an error?

查看:54
本文介绍了什么是(ERR!代码 ENOLOCAL npm ERR!)由于错误而无法安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将更新 npm 最新版本,但它显示此错误消息:

I am going to update npm latest version, but it's showing this error message:

G:\>npm i -g npm ERR! code ENOLOCAL npm ERR!
Could not install from "" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hemanth\AppData\Roaming\npm-cache\_logs\2018-01-08T03_34_29_774Z-debug.log
G:\>

推荐答案

这是由 Windows 用户名中的空格(可能在 Windows 中的名字和姓氏之间)引起的节点问题.

This is an issue in node which is caused by white space in your windows username (possibly between the first-name and last-name in windows).

>

在具有管理员访问权限的命令提示符下将 firstname 替换为您的 Windows 用户名字后运行以下命令

run the following command after replacing firstname with your windows user firstname in command prompt with administrator access

npm config set cache "C:\Users\Firstname~1\AppData\Roaming\npm-cache" --global

这篇关于什么是(ERR!代码 ENOLOCAL npm ERR!)由于错误而无法安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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