我试图使用链接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: [email protected] (node_modules\react-scripts\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: 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>
我有同样的错误,但是,语法不同。
尝试使用cmd
或VSCode终端,在C:\Users\thirunah
中创建您的反应应用程序。因为我认为在尝试在漫长的路径中创建反应应用程序时存在问题(C:\Users\thirunah\Documents\Visual Studio Code\my-app
)。
所以去cmd
,C:\Users\thirunah
(cd C:\Users\thirunah
)并写
create-react-app Your-app-name
在此之前,请确保安装了node
和create-react-app
。
您可以从node.js和cmd
中安装节点
npm create-react-app -g