Post List

2016년 10월 18일 화요일

Error: Cannot find module 'npmlog'

상태 : npm install 또는 -v 에서 아래와 같은 오류 발생

module.js:457
    throw err;
    ^

Error: Cannot find module 'npmlog'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at /usr/lib/node_modules/npm/bin/npm-cli.js:19:13
    at Object.<anonymous> (/usr/lib/node_modules/npm/bin/npm-cli.js:75:3)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)




1. sudo curl https://npmjs.org/install.sh | sh 실행

[binrang@localhost ~]$ sudo curl https://npmjs.org/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   193  100   193    0     0    195      0 --:--:-- --:--:-- --:--:--   195
sh: line 1: html: 그런 파일이나 디렉터리가 없습니다
sh: line 2: syntax error near unexpected token `<'
'h: line 2: `<head><title>301 Moved Permanently</title></head>

다른 에러 발생

이유 : 파이프 연결 명령인 sh가 루트 권한 필요

2. curl -0 -L http://npmjs.org/install.sh | sudo sh 실행
[binrang@localhost ~]$ curl -0 -L http://npmjs.org/install.sh | sudo sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0   193    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  6263  100  6263    0     0   4347      0  0:00:01  0:00:01 --:--:-- 6116k
tar=/bin/tar
version:
tar (GNU tar) 1.26
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
install npm@latest
fetching: http://registry.npmjs.org/npm/-/npm-3.10.8.tgz
- abbrev node_modules/npm/node_modules/abbrev
- ansi-regex node_modules/npm/node_modules/ansi-regex
- ansicolors node_modules/npm/node_modules/ansicolors
- ansistyles node_modules/npm/node_modules/ansistyles
- aproba node_modules/npm/node_modules/aproba
- archy node_modules/npm/node_modules/archy
- asap node_modules/npm/node_modules/asap

..................
  │ ├─┬ spdx-correct@1.0.2 
  │ │ └── spdx-license-ids@1.2.0 
  │ └─┬ spdx-expression-parse@1.0.2 
  │   ├── spdx-exceptions@1.0.4 
  │   └── spdx-license-ids@1.2.0 
  ├─┬ validate-npm-package-name@2.2.2 
  │ └── builtins@0.0.7 
  ├─┬ which@1.2.11 
  │ └── isexe@1.1.2 
  ├── wrappy@1.0.2 
  └── write-file-atomic@1.2.0 

It worked

해결 완료

댓글 없음:

댓글 쓰기