ubuntu 安装 npm、nodejs 各种问题

2018/09/19 22:46
阅读数 104

nodejs let notifier = require('update-notifier')({pkg}) 报错

先卸载nodejs,然后安装稳定最新版

# apt-get remove nodejs   //删除nodejs  
# curl -sL https://deb.nodesource.com/setup_8.x | sudo bash - //nodejs源  
# apt-get update //更新包  
# apt-get install nodejs //安装nodejs  
# npm install npm -g //更新npm  

Cannot find module 'are-we-there-yet'

1) Go to the global node_modules directory (what would npm root -g print if you could run it):

$ cd /usr/local/lib/node_modules
2) Remove the broken npm directory or move it somewhere else (note that you might need to elevate permissions for this and the following steps):

$ mv npm /tmp
3) Download and unpack fresh npm from the registry (substitute version you want to install, e.g. 3.10.8):

$ curl -L registry.npmjs.com/npm/-/npm-{VERSION}.tgz | tar xz --transform="s:^package:npm:"
You can automate some of that with this install script:

$ curl -L https://www.npmjs.com/install.sh | sh

参考

本文同步分享在 博客"削微寒的程序员之路"(CNBlog)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部