关于window下Node.js的本地包路径过长,导致一些功能无法使用

下午安装Yeoman的angular-generator时候,安装完成后我创建一个angular项目,但是运行

yo angular angularProject这句命令的时候确报了一个错,错误的内容就是下面这

You don't seem to have a generator with the name webapp installed.
You can see available generators with npm search yeoman-generator and then install them with npm install [name].
To see the 1 registered generators run yo with the `--help` option.

在node论坛问了下,都说没这个问题,后面有个哥们儿让我看下包路径,

我看了下是在C:UsersAdministratorAppDataRoaming pm下,他说这个路径太长了,可能会影响到,然后我就修改了抱得默认全局路径

在nodejs的安装目录中找到node_modules pm pmrc文件

修改如下即可:

prefix = D: odejs ode_global
cache = D: odejs ode_global

然后重新下载angular-generator,执行yo angular angularProject,解决问题。

PS:这里可能会依然出现,这个问题,清空npm发热cache目录,然后重新install generator-angular可以解决问题

原文地址:https://www.cnblogs.com/GrubbyHunter/p/4245200.html