Angular 6 对目录的非法操作,打开'/Users/<username>/.npm-global/lib/node_modules/ [英] Angular 6 illegal operation on a directory, open &#39;/Users/&lt;username&gt;/.npm-global/lib/node_modules/

查看:15
本文介绍了Angular 6 对目录的非法操作,打开'/Users/<username>/.npm-global/lib/node_modules/的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了一个教程,这样我就不必在使用 npm install 执行所有操作之前使用 sudo

I followed a tutorial so that I would not have to use sudo before everything that I do with npm install

将 npm 全局配置设置为新的教程目录

无论我做什么,现在它都会尝试安装到这个新的 ~/.npm-global 目录.我已经删了好几次了:

No matter what I do, now it everything tries to install to this new ~/.npm-global directory. I have deleted it several times:

sudo rm -R .npm-global/

我试图覆盖设置:

sudo npm set globalconfig ""
sudo npm set globalignorefile ""

但无论如何,如果我尝试运行以下内容:

But no matter what, if I try to run something like:

sudo npm install -g @angular/cli

我仍然看到它尝试安装到 .npm-global,然后出现几个警告,并且通常会在以下情况下停止:

I still see it trying to install to .npm-global, followed by several warnings and it usually stops on the following:

ERR! path /Users/<username>/.npm-global/lib/node_modules/@angular/cli/node_modules/atob/bin/atob.js

我该怎么做才能摆脱这个噩梦?请帮忙

What can I do to get out of this nightmare? Please help

推荐答案

如果其他人正在经历这种情况,我想我会发布我发现的内容.

In case someone else is going through this, I thought I post what I found.

首先,让我指出我解决了我的问题,但它引起了很多其他问题,所以请谨慎行事:

First, let me point out that I solved my issue, but it caused so many other issues, so tread carefully:

brew uninstall --force node
brew cleanup
sudo rm -f /usr/local/bin/npm 
sudo rm -f /usr/local/lib/dtrace/node.d;
sudo rm -rf ~/.npm;

第二,让我说我有一个较旧的操作系统 Yosemite,brew 不再支持它.结果,卸载确实删除了节点,但它也取消了许多与 php 和 apache 相关的链接,这让我不得不重新安装、配置、制作等...手动只是为了回到我以前的位置这些错误开始发生.

Second, let me say that I have an older OS Yosemite, which brew no longer supports. As a result, the uninstall did remove node, but it also unlinked many links related to php and apache, which left me to have to re-install, configure, make, etc... manually just to get back to where I was before these errors started occurring.

这包括从 php.net 运行 config、make、install 下载 php 5.6.9,这没有帮助,因为它覆盖了许多配置文件,包括我的 httpd.ssl.conf 文件,这将在接下来提到.顺便说一句, brew update 说一切都是最新的.它还会警告我 brew 不再支持我的操作系统,这就是我必须手动安装的原因.

This included downloading php 5.6.9 from php.net running config, make, install, which did not help things, because it over-wrote many config files, including my httpd.ssl.conf file, which will mention next. BTW, brew update said that everything was up to date. It would also warn me that brew no longer supports my operating system and this is why I had to install things manually.

将我的机器重新建立到原来的位置,包括重写我的 httpd.conf、httpd-vhosts.conf 和 httpd-ssl.conf 文件,这些文件绝对超出了本文的范围,但我想我会如果您应该采取这种方法,请警告您要存储的内容.

Re-establishing my machine to where it was, included re-writing my httpd.conf, httpd-vhosts.conf and httpd-ssl.conf files, which are definitely outside the scope of this post, but I thought I would warn whomever what you are in store for, if you should take this approach.

此外,在配置、制作、安装之后,我花了几个小时使用 brew link 重新链接链接 - 以下是一个小列表:

Also, after the config, make, install, I spent literally hours re-linking links using brew link - the following is a small list:

autoconf
automake
cloog-ppl015
composer
faac
ffmpeg
gdbm
gmp4
imagemagick
lame
libevent
libgpg-error
libksba
libmpc08
libtiff
libtool
libvo-aacenc
libyaml
mcrypt
mhash
mpfr2
mysql
nginx
ossp-uuid
pcre
php56
php56-http
php56-igbinary
php56-mcrypt
php56-memcache
php56-memcached
php56-mongo
php56-opcache
php56-propro
php56-raphf
php56-tidy
php56-xdebug
postgresql
ppl011
pv
python
unixodbc
x264
xvid
xz

我可以通过 brew update 和 brew doctor 找到这个列表.然后输入以下命令来修复 apache 发现的任何错误:

I was able to find this list by doing brew update, followed by brew doctor. This was followed by typing the following commands to fix whatever errors apache was finding:

sudo apachectl restart
httpd -t
httpd -S
php --version

一旦我处理了这个和那个模块没有加载的所有错误,系统就会回到错误之前的位置.有问题的错误发布在我向

Once I dealt with all the errors of this and that module not loading, the system was back to where it was before the errors. The errors in question are posted on another post that I made to

stackoverflow.com因为无法进行 ng build --prod

顺便说一句,即使这对我来说不再是问题,还有很多其他错误阻止 ng 创建构建,例如HTMLElement"类型上不存在属性value",属性shoppingCart"不存在于类型 {} 等...,但至少该应用功能齐全,以及它发布到的 PHP API,这是处理剩余错误的良好起点.

One more BTW, even though this is no longer an issue for me, there were plenty of other errors keeping ng from creating a build, such as Property 'value' does not exist on type 'HTMLElement', Property 'shoppingCart' does not exist on type {}, etc..., but at least the app is fully functional, along with the PHP API that it posts to and that is a good starting point to deal with the remaining errors.

另一件事,在所有重新安装后,我在尝试连接到 mysql 时收到以下错误:

One other thing, with all the re-installs, I was receiving the following error from trying to connect to mysql:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)

事实证明这是因为 mysql 的其他实例由于重新安装而正在运行,以及当我尝试使用 MAMP 进行连接时.我能够按照 的其中一个答案中的说明解决此问题关注帖子

This turned out to be because other instances of mysql were running due to re-installs, as well as, when I tried to use MAMP to connect. I was able to resolve this issue by following the instructions in one of the answers of the following post

首先,停止服务器:mysqld 停止

First, stop the server: mysqld stop

那是我第一次了解到有多个进程因以下重复错误而运行:

That is where I first understood that more than one process was running by the following repeated error:

2019-02-04 09:58:22 70222 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-02-04 09:58:22 70222 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.

然后找出正在运行的内容:

Then find out what is running:

ps aux | grep mysql

接着使用 kill 命令(重复)直到我需要的实例剩余,然后 mysql -u root -p 工作

Followed by using kill command (repeatedly) until the instance I needed was remaining, then mysql -u root -p worked

这篇关于Angular 6 对目录的非法操作,打开'/Users/<username>/.npm-global/lib/node_modules/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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