在windows server 2008我使用nodejs來運行我的js文件,所以要運行我的js需要有mysql,所以我用命令安裝了mysql:npm install mysql 安裝後有這個日誌:錯誤:找不到模塊'mysql'
C:\Users\lol>npm install mysql
npm http GET https://registry.npmjs.org/mysql
npm http 304 https://registry.npmjs.org/mysql
npm http GET https://registry.npmjs.org/bignumber.js/1.0.1
npm http GET https://registry.npmjs.org/require-all/0.0.3
npm http 304 https://registry.npmjs.org/require-all/0.0.3
npm http 304 https://registry.npmjs.org/bignumber.js/1.0.1
[email protected] node_modules\mysql
├── [email protected]
└── [email protected]
但埃夫裏的時候,我想運行我的js我有這樣的錯誤:
C:\Users\lol>node D:\node\npauthapi.js
module.js:340
throw err;
^
Error: Cannot find module 'mysql'
at Function.Module._resolveFilename (module.js:338:15
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (D:\node\npauthapi.js:1:75)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
或者將它安裝到'D:\ node',所以可以通過'npauthapi.js'訪問 – Mchl
確實,這是另一種解決方案,但我猜想mysql包會用在多個項目/文件夾中 –
請問你能給我一個正確的命令在其他路徑中安裝mysql?! – user2997361