使用npm密令安裝模組失敗 解決方法

2021-09-02 19:51:09 字數 1046 閱讀 5701

比如:使用 npm install mysql 安裝資料庫模組

安裝失敗,報錯error: cannot find module 'mysql'

at function.module._resolvefilename (module.js:469:15)

at function.module._load (module.js:417:25)

at module.require (module.js:497:17)

at require (internal/module.js:20:19)

at module._compile (module.js:570:32)

at object.module._extensions..js (module.js:579:10)

at module.load (module.js:487:32)

at trymoduleload (module.js:446:12)

at function.module._load (module.js:438:3)

[color=red]

進入 安裝目錄下的 f:\nodejs 如下

c:\users\1>cd f:\nodejs

f:\nodejs> npm install mysql 在使用此命令就安裝成功了

輸出如下

f:\nodejs>npm install mysql

[email protected] f:\nodejs\node_modules\npm

`-- [email protected]

+-- [email protected]

+-- [email protected]

| +-- [email protected]

| +-- [email protected]

| `-- [email protected]

`-- [email protected]

檢察是否安裝mysql成功

命令列 :npm list mysql

輸出[email protected] 版本 即安裝成功 [/color]

解決npm安裝node sass失敗的問題

將vue element admin從github上轉殖下來以後使用npm install命令時出現了錯誤,錯誤顯示是在安裝node sass時出了問題,在進行了多次嘗試之後發現了解決問題的方法。其中部分錯誤提示為 npm err cb never called npm err this is an...

npm安裝modules失敗

設定goagent 在我這裡失敗了 使用者配置或者全域性配置 2選1即可 npm config get userconfignpm config get globalconfigproxy http server port npm映象cnpmjs映象 npm registry taobao org ...

npm模組安裝

最開始接觸npm看見很多吐槽npm在windows上的不穩定,就選擇了在linux的伺服器上使用,但是後來發現很多人都是在windows能正常使用的,而且在伺服器上操作難免有所不便,所以就開始了我的npm折騰之路。2 npm模組的安裝,模組安裝有兩種一種是在自己專案的路徑下本地安裝,一種是全域性安裝...