mac 安装报错:
UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@tarojs/cli/templates/taro-temp' (Use
node --trace-warnings ...to show where the warning was created) (node:92495) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:92495) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
如下图:
Mac 解决方法:
1.使用npm root -g
找到你全局npm模块包的安装位置,即node_modules文件
2.进入这个安装位置,然后cd..
退出到 上一层
3.再使用sudo chown -R $applename $全局包的位置
,这个命令来给你的全局包开启权限。
(这里$applename
是苹果用户的名字,后面 $全局包的位置,就是第一步你获取的位置,直接粘过来,就好啦)
这样再运行项目,直接npm run dev
image.png
原文链接:https://blog.csdn.net/sinat_41695090/article/details/88292155
网友评论