前置环境
安装less
- 查看版本
lessc -v
- 安装
npm install -g less
安装历程
miyufeng@MacBook-Pro 源码和资料 % npm install -g less
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
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! A complete log of this run can be found in:
npm ERR! /Users/miyufeng/.npm/_logs/2022-05-12T14_58_50_349Z-debug.log
miyufeng@MacBook-Pro 源码和资料 % cnpm install -g less
Downloading less to /usr/local/lib/node_modules/less_tmp
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/less_tmp'
npminstall version: 5.0.1
npminstall args: /usr/local/bin/node /usr/local/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --fix-bug-versions --china --userconfig=/Users/miyufeng/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://registry.nlark.com -g less
miyufeng@MacBook-Pro 源码和资料 % sh root
sh: root: No such file or directory
miyufeng@MacBook-Pro 源码和资料 % suroot
zsh: command not found: suroot
miyufeng@MacBook-Pro 源码和资料 % su root
Password:
sh-3.2# npm install -g less
/usr/local/bin/lessc -> /usr/local/lib/node_modules/less/bin/lessc
+ less@4.1.2
added 20 packages from 54 contributors in 3.145s
sh-3.2# lessc -v
lessc 4.1.2 (Less Compiler) [JavaScript]
sh-3.2#
webstrom配置(也许不需要前面安装的步骤,大家可以测一下,告诉我哈)
webstrom -> Preferencs-> File Watchers