가장 간단한 node.js 스크립트를 사용하려고합니다.node.js에서 express를 요구할 수없는 이유는 무엇입니까?
server.js
require("express");
내가 regulare 노드 명령을 사용하여 스크립트를 실행 : 다음은 자바 스크립트 파일입니다
$ node server.js
을하지만 오류 얻을 :
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
at Function.<anonymous> (module.js:378:11)
at Object.<anonymous> (/home/shawn/.node_libraries/[email protected]/index.js:4:21)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/home/shawn/Documents/Projets/passingData/server.js:3:15)
at Module._compile (module.js:441:26)
을
무슨 일 이니?
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
at Function.<anonymous> (module.js:378:11)
at Object.<anonymous> (/home/shawn/.node_libraries/[email protected]/index.js:4:21)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/usr/lib/nodejs/fstream/lib/dir-reader.js:11:13)
at Module._compile (module.js:441:26)
'npm install express'를 아직 해 보셨습니까? – sntran
'npm install express'도 오류가 발생합니다. 내 편집을 참조하십시오. – Shawn
늙은 npm 인 것 같습니다. node.js 및 npm을 현재 안정된 버전으로 업데이트하십시오. –