node.js - Problems upgrading npm version
问题描述
I was trying to upgrade npm version:
npm -v
5.6.0
sudo npm install -g npm@6
/home/${user}/.npm-global/bin/npm -> /home/${user}/.npm-global/lib/node_modules/npm/bin/npm-cli.js
/home/${user}/.npm-global/bin/npx -> /home/${user}/.npm-global/lib/node_modules/npm/bin/npx-cli.js
+ npm@6.4.1
updated 1 package in 20.723s
but still remain version of v5.6.0 after I checked with
npm -v
5.6.0
I'm using Windows 10 (version 1803) but I have nodejs installed on WSL running Ubuntu 18.04 Node was install following these steps
UPDATE:
It's seems a problem with oh-my-zsh… Because I tried from bash and the versions is correct (6.4.1) and from bash when I type zsh
I get 6.4.1
npm version. But when I start the terminal, zsh don't load the correct npm version.
I'm loading oh-my-zsh with this way
~/.bashrc
bash -c zsh
解决方案
尝试清除 npm 缓存:
npm cache clean --force
然后
npm i npm@6 -g
希望能帮助到你。
推荐阅读
- docker - 无法使用 docker login --password-stdin
- sql - 当我从 mockaroo.com 导入日期时,显示日期但缺少时间
- camunda - 运行时和历史的分离
- angular - 如何将 Angular 语言环境日期转换为 API 使用的正确日期格式?
- android - 从android项目构建jar文件时任务':app:kaptGenerateStubsDebugKotlin'的执行失败
- ios - 在 B2B 应用程序中支持第三方支付方式
- angular - Internet Explorer 中的“无法将对象转换为原始值”
- android - Google Play Billing 2.0 测试待处理交易和确认
- react-native - ReactNative:组件中的统一参数使用可能吗?
- r - ggplot() 的可变行限制