[npm error] WARN logfile could not be created how to solve

 

First come to the error content:

npm WARN logfile could not be created: Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_cache\_logs\2022-07-21T09_43_50_743Z-debug-0.log'
npm WARN logfile could not be created: Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_cache\_logs\2022-07-21T09_43_51_174Z-debug-0.log'

Cause: Use npm to install the cnpm tool, just configured prefix and cache, but execute

npm install -g cnpm --registry=https://registry.npm.taobao.org

An error is reported in the code segment. After searching, it is found that the command line tool cmd is not in administrator mode. When using the npm command, you cannot write the log to the nodejs directory with administrator privileges.

Solution:

 

It can be solved by granting permissions to the user group in the two folders

 

Guess you like

Origin blog.csdn.net/weixin_56170314/article/details/125917683