在visual studio代码中安装react js时出错

时间:2017-06-13 10:59:31

标签: node.js reactjs visual-studio-code npm-install

我尝试使用链接https://code.visualstudio.com/docs/nodejs/reactjs-tutorial创建反应应用 但是当我运行命令时,我得到以下错误

  

create-react-app my-app

错误

Creating a new React app in C:\Users\thirunah\Documents\Visual Studio Code\my-app.

Installing packages. This might take a couple minutes.
Installing react, react-dom, and react-scripts...

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.0.17 (node_modules\react-scripts\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","ar
ch":"x64"})
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "--save-exact" "
react" "react-dom" "react-scripts"
npm ERR! node v7.4.0
npm ERR! npm  v4.0.5
npm ERR! code E403

npm ERR! unregistered users are not allowed to access package @timer/detect-port : @timer/detect-port
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

2 个答案:

答案 0 :(得分:0)

我有同样的错误,但是语法不同。
尝试使用 protected X509Certificate verifyClientCertificate(HttpServletRequest req) { X509Certificate[] certs = (X509Certificate[]) req.getAttribute("javax.servlet.request.X509Certificate"); if (null != certs && certs.length > 0) { return certs[0]; } // .... throw new RuntimeException("No X.509 client certificate found in request"); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException { System.out.println("DO POST"); verifyClientCertificate(request); super.doPost(request, response); } 或VSCode终端,在cmd中创建您的react应用。由于我认为尝试以长路径(C:\Users\thirunah)创建react应用时存在问题。

因此,转到C:\Users\thirunah\Documents\Visual Studio Code\my-appcmdC:\Users\thirunah)并写

cd C:\Users\thirunah

在此之前,请确保已安装create-react-app Your-app-name node
您可以从node.js安装节点,并在create-react-app中编写

cmd

答案 1 :(得分:0)

来自docs

npx create-react-app my-app
cd my-app
npm start
  

(npx随npm 5.2及更高版本一起提供,请参阅旧版npm的说明   版本)