$ npm install -g express
npm ERR! Error: EACCES, mkdir '/usr/lib/node_modules/express'
npm ERR! { [Error: EACCES, mkdir '/usr/lib/node_modules/express']
npm ERR! errno: ,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/lib/node_modules/express',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/lib/node_modules/express',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:108:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator. npm ERR! System Linux 4.4.--generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "express"
npm ERR! cwd /home/zmj97
npm ERR! node -v v0.10.37
npm ERR! npm -v 1.4.
npm ERR! path /usr/lib/node_modules/express
npm ERR! fstream_path /usr/lib/node_modules/express
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno
npm ERR! stack Error: EACCES, mkdir '/usr/lib/node_modules/express'
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js::
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/mkdirp/index.js::
npm ERR! fstream_stack Object.oncomplete (fs.js::)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/zmj97/npm-debug.log
npm ERR! not ok code

在全局安装时报错,提示“Please try running this command again as root/Administrator.”,

加上sudo即可。

$ sudo npm install -g express
[sudo] password for zmj97:
express@4.14. /usr/lib/node_modules/express
├── escape-html@1.0.
├── array-flatten@1.1.
├── utils-merge@1.0.
├── cookie-signature@1.0.
├── merge-descriptors@1.0.
├── fresh@0.3.
├── methods@1.1.
├── path-to-regexp@0.1.
├── vary@1.1.
├── encodeurl@1.0.
├── range-parser@1.2.
├── parseurl@1.3.
├── etag@1.7.
├── content-type@1.0.
├── cookie@0.3.
├── content-disposition@0.5.
├── serve-static@1.11.
├── depd@1.1.
├── qs@6.2.
├── on-finished@2.3. (ee-first@1.1.)
├── debug@2.2. (ms@0.7.)
├── finalhandler@0.5. (unpipe@1.0., statuses@1.3.)
├── proxy-addr@1.1. (forwarded@0.1., ipaddr.js@1.1.)
├── type-is@1.6. (media-typer@0.3., mime-types@2.1.)
├── accepts@1.3. (negotiator@0.6., mime-types@2.1.)
└── send@0.14. (destroy@1.0., ms@0.7., mime@1.3., statuses@1.3., http-errors@1.5.)

安装成功!

查看已安装包中包括express:

$ npm ls -g
/usr/lib
├─┬ express@4.14.
│ ├─┬ accepts@1.3.
│ │ ├─┬ mime-types@2.1.
│ │ │ └── mime-db@1.25.
│ │ └── negotiator@0.6.
│ ├── array-flatten@1.1.
│ ├── content-disposition@0.5.
│ ├── content-type@1.0.
│ ├── cookie@0.3.
│ ├── cookie-signature@1.0.
│ ├─┬ debug@2.2.
│ │ └── ms@0.7.
│ ├── depd@1.1.
│ ├── encodeurl@1.0.
│ ├── escape-html@1.0.
│ ├── etag@1.7.
│ ├─┬ finalhandler@0.5.
│ │ ├── statuses@1.3.
│ │ └── unpipe@1.0.
│ ├── fresh@0.3.
│ ├── merge-descriptors@1.0.
│ ├── methods@1.1.
│ ├─┬ on-finished@2.3.
│ │ └── ee-first@1.1.
│ ├── parseurl@1.3.
│ ├── path-to-regexp@0.1.
│ ├─┬ proxy-addr@1.1.
│ │ ├── forwarded@0.1.
│ │ └── ipaddr.js@1.1.
│ ├── qs@6.2.
│ ├── range-parser@1.2.
│ ├─┬ send@0.14.
│ │ ├── destroy@1.0.
│ │ ├─┬ http-errors@1.5.
│ │ │ ├── inherits@2.0.
│ │ │ └── setprototypeof@1.0.
│ │ ├── mime@1.3.
│ │ ├── ms@0.7.
│ │ └── statuses@1.3.
│ ├── serve-static@1.11.
│ ├─┬ type-is@1.6.
│ │ ├── media-typer@0.3.
│ │ └─┬ mime-types@2.1.
│ │ └── mime-db@1.25.
│ ├── utils-merge@1.0.
│ └── vary@1.1.

在Ubuntu全局安装express报错:Error: EACCES, mkdir '/usr/lib/node_modules/express'的解决办法的更多相关文章

  1. [原创] ubuntu下安装scrapy报错 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    Ubuntu14.04在virtualenv下安装scrapy报错,Failed building wheel for cffi,lxml,cryptography 等. error: command ...

  2. 安装Scrapy报错 error: Microsoft Visual C++ 14.0 is required解决方法

    [问题背景]:在Windows 10系统,pip install Scrapy,报错error: Microsoft Visual C++ 14.0 is required,还有提示Twisted需要 ...

  3. CentOS7安装MySQL报错Failed to start mysqld.service: Unit not found解决办法

    1 ~]# systemctl start mysql.service 要启动MySQL数据库是却是这样的提示 1 ~]# Failed to start mysqld.service: Unit n ...

  4. 抓取https网页时,报错sun.security.validator.ValidatorException: PKIX path building failed 解决办法

    抓取https网页时,报错sun.security.validator.ValidatorException: PKIX path building failed 解决办法 原因是https证书问题, ...

  5. ubuntu pip 安装django报错解决

    系统版本 ubuntu  Kylin 16.04 LTS       安装pip3 安装 Django 总是提示time out,无法安装. 逛了好多论坛终于遭到了解决办法,分享保存: sudo pi ...

  6. python27(32位)安装模块报错“error: Unable to find vcvarsall.bat”

    1)首先,下载一个Microsoft Visual C++ Compiler for Python 2.7的补丁,下载地址在这里: http://www.microsoft.com/en-us/dow ...

  7. 安装zabbix-agent报错 Error: failure: repodata/primary.xml.gz from zabbix: [Errno 256] No more mirrors to try.

    安装zabbix-agent报错 yum install -y zabbix-agent Loaded plugins: fastestmirror, refresh-packagekit, secu ...

  8. 【问题】yum安装软件报错ERROR:dbus.proxies

    转自:Yum安装报错:ERROR:dbus.proxies 环境: [红帽企业Linux.6.4.服务器版].rhel-server-6.4-x86_64-dvd(ED2000.COM).iso 安装 ...

  9. 安装nghttp2 报错error: Libtool library used but 'LIBTOOL' is undefined

    nghttp2 报错error: Libtool library used but ‘LIBTOOL‘ is undefined 如果重新安装libtool和autoconf升级到2.69后,还是报错 ...

随机推荐

  1. NK3C 业务权限控制

    资源中,添加了一个类型:权限(橙色显示),现在有4种数据: 域管理员:domainAdmin 组织管理员:orgAdmin 组管理员:groupAdmin 一线员工:phoneAdmin 权限控制可以 ...

  2. NHibernate系列文章十四:NHibernate事务

    摘要 NHibernate实现事务机制非常简单,调用ISession.BeginTransaction()开启一个事务对象ITransaction,使用ITransaction.Commit()提交事 ...

  3. WampServer服务中MySQL无法正常启动解决方案

    打开wampserver->mysql->my.ini,添加或修改innodb_force_recovery = 1 然后重启所有服务就大功告成了!

  4. 移动端自动化环境搭建-JDK的安装

    一.安装jdk A.安装依赖 JDK作为JAVA开发的环境,不管是做JAVA开发的学生,还是做安卓开发的同学,都必须在电脑上安装JDK. B.安装过程 安装JDK 选择安装目录 安装过程中会出现两次 ...

  5. hive 中窗口函数row_number,rank,dense_ran,ntile分析函数的用法

    hive中一般取top n时,row_number(),rank,dense_ran()这三个函数就派上用场了, 先简单说下这三函数都是排名的,不过呢还有点细微的区别. 通过代码运行结果一看就明白了. ...

  6. MySQL的数据库无法插入中文是怎么回事?

    插入中文就报错: Incorrect string value: '\xE7\x8F\xBD\xE7\x8F\xBA' for column 'name' at row 1 用set names ut ...

  7. MongoDB-JAVA-Driver 3.2版本常用代码全整理(2) - 查询

    MongoDB的3.x版本Java驱动相对2.x做了全新的设计,类库和使用方法上有很大区别.例如用Document替换BasicDBObject.通过Builders类构建Bson替代直接输入$命令等 ...

  8. LINUX内核分析第七周学习总结:可执行程序的装载

    LINUX内核分析第七周学习总结:可执行程序的装载 韩玉琪 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课程http://mooc.study.163.com/cours ...

  9. js中~~的用法

    ~~(Math.random()*(1<<24))).toString(16) ~~的作用相当于parseInt

  10. scala 学习: case class

    case class: 1.定义为case class 的类在实例化时,可以不使用new 关键字. case class People(name:String, age:Int) val zhangs ...