尝试安装gatsby.js时,出现很多错误

时间:2019-12-08 08:12:04

标签: node.js npm gatsby

当我尝试全局安装 gatsby-cli 时,会发生以下情况:

这实际上是权限问题吗?还是我错过了什么?

  

npm WARN不赞成使用core-js@2.6.10:不再使用core-js @ <3.0   维护,由于问题的数量,不建议使用。   请将您的依赖项升级到core-js @ 3的实际版本。   npm WARN ink@2.6.0需要一个@ types / react @> = 16.8.0的同位体,但没有一个   已安装。您必须自己安装对等依赖项。 npm警告   auto-bind@3.0.0需要一个@ types / react @> = 16.8.0的同位体,但没有   已安装。您必须自己安装对等依赖项。

     

npm错误!代码EACCES npm ERR! syscall symlink npm错误!路径   ../lib/node_modules/gatsby-cli/lib/index.js npm错误! dest   / usr / local / bin / gatsby npm错误! errno -13 npm错误!错误:EACCES:   权限被拒绝,符号链接   '../lib/node_modules/gatsby-cli/lib/index.js'->   '/ usr / local / bin / gatsby'npm错误! [OperationalError:EACCES:   权限被拒绝,符号链接   '../lib/node_modules/gatsby-cli/lib/index.js'->   '/ usr / local / bin / gatsby'] {npm ERR!原因:[错误:EACCES:   权限被拒绝,符号链接   '../lib/node_modules/gatsby-cli/lib/index.js'->   '/ usr / local / bin / gatsby'] {npm ERR! errno:-13,npm错误!码:   “ EACCES”,npm ERR! syscall:“ symlink”,npm错误!路径:   '../lib/node_modules/gatsby-cli/lib/index.js',npm错误!目标:   '/ usr / local / bin / gatsby'npm错误! },npm错误!堆栈:“错误:   EACCES:权限被拒绝,符号链接   '../lib/node_modules/gatsby-cli/lib/index.js'->   '/ usr / local / bin / gatsby'“,npm ERR!错误号:-13,npm ERR!代码:   “ EACCES”,npm ERR! syscall:“ symlink”,npm错误!路径:   '../lib/node_modules/gatsby-cli/lib/index.js',npm错误!目标:   '/ usr / local / bin / gatsby'npm错误! } npm ERR! npm ERR!手术   被您的操作系统拒绝。 npm ERR!你可能会做   没有权限以当前用户npm的身份访问此文件   呃! npm ERR!如果您认为这可能是权限问题,   请仔细检查npm ERR!文件及其权限   包含目录,或尝试运行npm ERR!命令再次作为   root /管理员。

1 个答案:

答案 0 :(得分:0)

使用下面的方法解决

<!DOCTYPE html> <html> <head> <title>Try jQuery Online</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script> $(document).ready(function() { $("em").addClass("selected"); $("#myid").addClass("highlight"); }); function clicks(e){ alert(e.id);alert(e.value); } </script> <style> .selected { color:red; } .highlight { background:yellow; } </style> </head> <body> <em title="Bold and Brave">This is first paragraph.</em> <p id="myid">This is second paragraph.</p> <select id ="id_name " onchange="clicks(this)"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> </body> </html>