goland中npm無法使用的問題及解決

goland中npm無法使用

明明已經成功安裝且配置瞭環境到windows上,而且goland上的配置也絲毫無錯,但是就是不能使用npm,讓人苦惱,如果你也遇到瞭這樣的問題,希望這篇文章可以幫到你。

出現的錯誤代碼是這樣的

PS C:\Users\Lenovo\GolandProjects\shop_client1> npm install
npm WARN logfile could not be created: Error: EPERM: operation not permitted, open 'D:\AAA\nodejs\node_cache\_logs\2022-04-19T11_00_18_499Z-debug-0.log'
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path D:\AAA\nodejs\node_cache\_cacache\index-v5\7b\bf
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'D:\AAA\nodejs\node_cache\_cacache\index-v5\7b\bf'
npm ERR!  [Error: EPERM: operation not permitted, mkdir 'D:\AAA\nodejs\node_cache\_cacache\index-v5\7b\bf'] {        
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: 'D:\\AAA\\nodejs\\node_cache\\_cacache\\index-v5\\7b\\bf'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! Log files were not written due to an error writing to the directory: D:\AAA\nodejs\node_cache\_logs
npm ERR! You can rerun the command with `–loglevel=verbose` to see the logs in your terminal

.npmrc文件,就是npm的配置文件所在位置。

當然,尋找這個文件的目的,多數是為瞭修改.npmrc文件內容。

npm提供瞭方便快捷的修改方式,不知道這個文件的位置,其實也是可以修改的。

於是,配置之間就產生瞭沖突,找到他刪掉它就可以瞭

默認位置是在  C:\Users\Lenovo  它是隱藏的

之後就可以繼續我們的項目瞭,拜拜 

 logfile could not be created: Error: EPERM: operation not permitted, open 'D:\AAA\nodejs\node_cache\_logs\2022-04-19T11_02_14_336Z-debug-0.log'
[………………] | : WARN logfile could not be created: Error: EPERM: operation not permitted, open 'D:\AAA\node 
> [email protected] dev
> webpack-dev-server –inline –progress –config build/webpack.dev.conf.js

npm ERR!無法安裝任何包的解決

npm config set proxy false
npm cache clean

總結

以上為個人經驗,希望能給大傢一個參考,也希望大傢多多支持WalkonNet。

推薦閱讀: