Can*_*ğlu 1 homebrew node.js npm homebrew-cask npm-install
每当我运行任何npm脚本时,我都会收到以下警告:
npm WARN npm npm does not support Node.js v12.4.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11.
npm WARN npm You can find the latest version at https://nodejs.org/
Run Code Online (Sandbox Code Playgroud)
它说我应该升级到新版本,但是v12.4 是最新版本。即使脚本运行良好,我也无法保证,并且随时可能会出错。
我还尝试过更新npm,以防万一有更新的版本使用,npm install npm -g但出现错误:
npm ERR! path /usr/local/Cellar/node/12.4.0/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'] {
npm ERR! stack: 'Error: EACCES: permission denied, access ' +
npm ERR! "'/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'
npm ERR! }
npm ERR!
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).
Run Code Online (Sandbox Code Playgroud)
然后,我看到npm无法使用npm本身更新Homebrew版本,因此我尝试通过Homebrew使用进行更新,brew upgrade npm但出现此错误:
Error: npm 12.4.0 already installed
由于某种原因,Brew混合了nodes和npms版本。
我做错了什么,如何摆脱这个警告?
小智 23
什么对我有用:
如果您尝试运行此命令“npm cache clean -f”但它不起作用,
在您的 Windows 机器上(我的是 Windows 10)访问此位置“~\AppData\Roaming\”中的“npm”和“npm-cache”文件夹
删除这两个文件夹“npm”和“npm-cache”。
转到您的 Windows 搜索栏并搜索 Node,右键单击以打开文件位置,运行卸载程序以卸载 NodeJs。
然后访问 nodejs.org 并再次下载并安装 node,如果您已经下载了它,请访问您下载它的文件夹以重新安装它。
安装后,通过在命令终端上键入“npm -v”来检查您的 npm 版本,以查看您的机器上安装的新的 npm 更新版本。
现在你已经准备好了,快乐编码。
似乎您搞砸了中的权限/usr/local。
解决方法如下:
修复/usr/local权限:
sudo chown -R `id -un`:`id -gn` /usr/local
Run Code Online (Sandbox Code Playgroud)清理npm缓存并将其卸载:
npm cache clean -f
npm -g uninstall npm
Run Code Online (Sandbox Code Playgroud)重新安装node(带有npm)
brew reinstall node
Run Code Online (Sandbox Code Playgroud)升级npm:
npm -g i npm
Run Code Online (Sandbox Code Playgroud)那应该带来npm@6.9.2。
您应该避免在使用或sudo安装软件时使用,这可能会导致类似这样的问题。brewnpm
| 归档时间: |
|
| 查看次数: |
1599 次 |
| 最近记录: |