首先,在nodejs安装的目录下新建两个文件夹
其次,新建系统变量
变量名NODE\_PATH
变量值D:\Program Files\nodejs\node\_modules
, 这里写你安装之后node\_modules
所在的路径
然后,在用户变量的Path中将改为D:\Program Files\nodejs\node\_global
(此处是node\_global
所在的路径)
最后,在系统变量的Path中新建两个变量,D:\Program Files\nodejs\
(nodejs根目录的路径,需要根据自己安装的路径来配)和%NODE\_PATH%
--
cmd命令窗输入`npm -v时,遇到以下错误
原因:C:\Users\xxx
(xxx是用户名)这个路径下,有.npmrc文件,打开我发现最后一行重复了,把它删除即可。
cmd命令窗输入`npm install -g cnpm --registry=https://registry.npm.taobao.org
`配置全局淘宝镜像时,遇到以下**错误**
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path D:\Program Files\nodejs\node\_cache\\_cacache
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'D:\Program Files\nodejs\node\_cache\\_cacache'
npm ERR! [OperationalError: EPERM: operation not permitted, mkdir 'D:\Program Files\nodejs\node\_cache\\_cacache'] {
npm ERR! cause: [Error: EPERM: operation not permitted, mkdir 'D:\Program Files\nodejs\node\_cache\\_cacache'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'D:\\Program Files\\nodejs\\node\_cache\\\_cacache'
npm ERR! },
npm ERR! isOperational: true,
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'D:\\Program Files\\nodejs\\node\_cache\\\_cacache'
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.
原因: 看错误的最后一行,没有以管理员身份运行cmd
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。