假期后第一天上班npm install 就出错了,啥原因
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了假期后第一天上班npm install 就出错了,啥原因相关的知识,希望对你有一定的参考价值。
看一下 C:\Users\Administrator\AppData\Roaming\npm-cache\mime\1.2.11\package\package.json 是不是一个合法的 JSON 文件,估计是被 ISP 插了广告,导致 npm 无法解析。刚开始基础node.js 和express ,当用npm install 产生依赖时,报了一大堆错误,
npm WARN deprecated static-favicon@1.0.2: use serve-favicon module
microbolg@0.0.1 /home/cy/Programs/nodejs/lib/node_modules/microbolg
├── debug@0.7.4
├── static-favicon@1.0.2
├── morgan@1.0.1 (bytes@0.3.0)
├── cookie-parser@1.0.1 (cookie-signature@1.0.3, cookie@0.1.0)
├── body-parser@1.0.2 (qs@0.6.6, raw-body@1.1.7, type-is@1.1.0)
├── express@4.2.0 (parseurl@1.0.1, utils-merge@1.0.0, merge-descriptors@0.0.2, cookie@0.1.2, escape-html@1.0.1, debug@0.8.1, cookie-signature@1.0.3, fresh@0.2.2, range-parser@1.0.0, qs@0.6.6, methods@1.0.0, buffer-crc32@0.2.1, serve-static@1.1.0, path-to-regexp@0.1.2, type-is@1.1.0, accepts@1.0.1, send@0.3.0)
└── jade@1.3.1 (character-parser@1.2.0, commander@2.1.0, mkdirp@0.3.5, monocle@1.1.51, transformers@2.1.0, constantinople@2.0.1, with@3.0.1)
root@ubuntu:/mnt/hgfs/js_test/microbolg# npm install
npm ERR! Error: ENOENT, lstat '/mnt/hgfs/js_test/microbolg/node_modules/jade/node_modules/with/node_modules/uglify-js/node_modules/source-map/lib/source-map/util.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!
npm ERR! System Linux 3.13.0-32-generic
npm ERR! command "/home/cy/Programs/nodejs/bin/node" "/home/cy/Programs/nodejs/bin/npm" "install"
npm ERR! cwd /mnt/hgfs/js_test/microbolg
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.23
npm ERR! path /mnt/hgfs/js_test/microbolg/node_modules/jade/node_modules/with/node_modules/uglify-js/node_modules/source-map/lib/source-map/util.js
npm ERR! fstream_path /mnt/hgfs/js_test/microbolg/node_modules/jade/node_modules/with/node_modules/uglify-js/node_modules/source-map/lib/source-map/util.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /home/cy/Programs/nodejs/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (evalmachine.:107:15)
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/mnt/hgfs/js_test/microbolg/node_modules/jade/node_modules/monocle/node_modules/readdirp'
npm ERR! error rolling back jade@1.3.1 [Error: ENOTEMPTY, rmdir '/mnt/hgfs/js_test/microbolg/node_modules/jade/node_modules/monocle/node_modules/readdirp']
npm ERR! error rolling back errno: 53,
npm ERR! error rolling back code: 'ENOTEMPTY',
npm ERR! error rolling back path: '/mnt/hgfs/js_test/microbolg/node_modules/jade/node_modules/monocle/node_modules/readdirp'
npm ERR! Error: UNKNOWN, symlink '../uglify-js/bin/uglifyjs'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!
npm ERR! System Linux 3.13.0-32-generic
npm ERR! command "/home/cy/Programs/nodejs/bin/node" "/home/cy/Programs/nodejs/bin/npm" "install"
npm ERR! cwd /mnt/hgfs/js_test/microbolg
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.23
npm ERR! path ../uglify-js/bin/uglifyjs
npm ERR! code UNKNOWN
npm ERR! errno -1
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /mnt/hgfs/js_test/microbolg/npm-debug.log
npm ERR! not ok code 0
解决: npm install -g 并且我是在root用户下 参考技术A 命令中,全局安装(global)和本地安装(local)方式的区别为带参数-g和不带参数-g。 具体区别: 1.安装位置: npm install moduleName ,则是将模块下载到当前命令行所在目录。 npm install moduleName -g ,模块将被下载安装到全局目录中
以上是关于假期后第一天上班npm install 就出错了,啥原因的主要内容,如果未能解决你的问题,请参考以下文章