Translate

[IntelliJ] Yeoman 연동 시 module.js:338 throw err; 증상 해결방법




OS: Ubuntu 15.10 (Gnome)
Tool: IntelliJ IDEA 15.0.4



증상

Yeoman PlugIn 설치 후 Yeoman 을 이용해서 모듈을 생성하려 하는데 아래와 같은 증상이 발생하며 프로젝트를 정상적으로 만들 수 없었다.



module.js:338
    throw err;
          ^
Error: Cannot find module '/home/lucifer/.npm/yo/1.7.0/package/node_modules/inquirer'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/home/lucifer/.IntelliJIdea15/config/plugins/Yeoman/runner/yeoman-simple-cli/lib/cli.js:105:16)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)









해결방법


1. 모듈 생성 시 Yoman 부분에서 'Configure Node.js and Yeoman' 를 선택한다.




2. Node 실행파일과 Yeoman yo package 경로를 입력 한다.


(Node 실행파일 위치, Yeoman yo package 경로 확인 방법)

lucifer@lucifer-Vostro-V13:~$ type node
node is /usr/bin/node
lucifer@lucifer-Vostro-V13:~$
lucifer@lucifer-Vostro-V13:~$ type yo
yo is /usr/local/bin/yo
lucifer@lucifer-Vostro-V13:~$
lucifer@lucifer-Vostro-V13:~$ ls -l /usr/local/bin/yo
lrwxrwxrwx 1 root root 33 Mar  1 12:29 /usr/local/bin/yo -> ../lib/node_modules/yo/lib/cli.js
lucifer@lucifer-Vostro-V13:~$
lucifer@lucifer-Vostro-V13:~$ cd /usr/local/lib/node_modules/yo/
lucifer@lucifer-Vostro-V13:/usr/local/lib/node_modules/yo$
lucifer@lucifer-Vostro-V13:/usr/local/lib/node_modules/yo$ ls -l
total 20
drwxr-xr-x  4 nobody lucifer 4096 Mar  1 12:29 lib
drwxr-xr-x 31 nobody lucifer 4096 Mar  1 12:29 node_modules
-rw-r--r--  1 nobody lucifer 3406 Mar  1 12:29 package.json
-rw-r--r--  1 nobody lucifer 7350 Feb 27 05:44 readme.md
lucifer@lucifer-Vostro-V13:/usr/local/lib/node_modules/yo$





3. 다시한번 모듈을 생성하면 아래와 같이 보여지게 된다.






댓글