在目录上进行Angular 6非法操作,请打开'/Users/<username>/.npm-global/lib/node_modules/ [英] Angular 6 illegal operation on a directory, open '/Users/<username>/.npm-global/lib/node_modules/

查看:72
本文介绍了在目录上进行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下载php 5.6.9,这无济于事,因为它重写了许多配置文件,包括我的httpd.ssl.conf文件,这将在后面提到.顺便说一句,brew更新表示一切都是最新的.它还会警告我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 brew链接重新链接-以下是一小段清单:

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更新,然后由brew医生来找到此列表.接下来,键入以下命令来修复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

还有一个BTW,即使这对我而言不再是一个问题,但仍有许多其他错误使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)

事实证明是因为重新安装,以及当我尝试使用MAMP进行连接时,正在运行其他mysql实例.通过遵循正在关注

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/&lt;username&gt;/.npm-global/lib/node_modules/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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