简体   繁体   English

npx create-nuxt-app<project-name> 不工作</project-name>

[英]npx create-nuxt-app <project-name> not working

I want to create Nuxt.Js app using npx.我想使用 npx 创建 Nuxt.Js 应用程序。 But i am getting following error.但我收到以下错误。 在此处输入图像描述

You have a space in your Windows username.您的 Windows 用户名中有一个空格。 This is a problem with NPX .这是NPX的问题。

This is the path that NPM sees (which is right)这是NPM看到的路径(这是对的)

  • 正确的道路

This is the path that NPX sees (which is wrong)这是NPX看到的路径(这是错误的)

  • 在此处输入图片说明

You can fix it by changing your NPM-Cache to another directory (without a space in the path):您可以通过将 NPM-Cache 更改为另一个目录(路径中没有空格)来修复它:

npm config set cache C:\your\new\path\npm-cache --global

Source: https://github.com/zkat/npx/issues/146#issuecomment-384016791来源: https : //github.com/zkat/npx/issues/146#issuecomment-384016791

I changed npm-cache directory by writing following command我通过编写以下命令更改了 npm-cache 目录

npm config set cache C:\tmp\nodejs\npm-cache --global

After that npx create-nuxt-app <project-name> worked perfectly.之后npx create-nuxt-app <project-name>完美运行。

我使用这个命令让它工作。

npm init nuxt-app <project-name>

This problem was resolved in a reddit此问题已在 reddit 中解决

https://www.reddit.com/r/vuejs/comments/ie8vab/createnuxtapp_not_working_anyone_else_had_this/ https://www.reddit.com/r/vuejs/comments/ie8vab/createenuxtapp_not_working_anyone_else_had_this/

Install it with:安装它:

npm i -g create-nuxt-app

Usually npm/npx should propose you to install, but it might not work This issue can appear if during first try the installation was aborted通常 npm/npx 应该建议您安装,但它可能无法工作如果在第一次尝试安装时中止,则会出现此问题

I have encountered similar problem and I have multiple spaces in the username.我遇到了类似的问题,我的用户名中有多个空格。

If the above solutions does not work for you on Windows, there is another way.如果上述解决方案在 Windows 上对您不起作用,还有另一种方法。

  1. Run VS code editor as an administrator.以管理员身份运行 VS 代码编辑器。
  2. Open the integrated terminal by clicking on Terminal > New Terminal or by pressing CTRL + SHIFT + '单击“终端” >“新建终端”或按 CTRL + SHIFT + ' 打开集成终端
  3. Instead of using npx use the following而不是使用 npx 使用以下

    npm init nuxt-app project-name npm init nuxt-app 项目名称

Point number 3 will only work if you run the VS code editor as Administrator.仅当您以管理员身份运行 VS 代码编辑器时,第 3 点才有效。 I am sure it is the same with external terminals.我确信它与外部端子相同。 Run CMD/Gitbash as Administrator以管理员身份运行 CMD/Gitbash

Hope this helps.希望这可以帮助。 :D :D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 npx create-nuxt-app 后跟 npm 运行开发抛出 Vue 包版本不匹配 - npx create-nuxt-app followed by npm run dev throws Vue packages version mismatch npx create-fusion-app无法正常工作。 Fusion.js - npx create-fusion-app not working. fusion.js 将 Cesium/Resium 与 npx create-react-app 的构建集成不起作用 - Integrating Cesium/Resium with a build of npx create-react-app is not working npx create-react-app 命令不起作用 - npx create-react-app command does not working React 安装问题 npx-create-react-app 无法正常工作 - React Installation problem npx-create-react-app not working properly npx create-react-app<app name> 什么都不做 没有错误 没有安装</app> - npx create-react-app <app name> doing nothing no error no installation 为什么 npx create-react-app my-first-app 不起作用? - Why npx create-react-app my-first-app is not working? npx 创建反应应用程序<name>在某个部分后停止运行 - npx create-react-app <name> stops running after a certain part wan 我使用 npx create-react-app App_Name 创建新的反应应用程序显示此错误(发现 8 个漏洞) - wan i create new react App using npx create-react-app App_Name Its Show This Error (found 8 vulnerabilities) npx create-react-app my-app 错误:rollbackFailedOptional - npx create-react-app my-app ERORR: rollbackFailedOptional
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM