欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

解决webstorm创建vue项目报错

程序员文章站 2022-03-13 17:31:24
解决webstorm创建vue项目报错:报错如下:0 info it worked if it ends with ok1 verbose cli [1 verbose cli 'D:\\Work Programs\\node\\node.exe',1 verbose cli 'D:\\Work Programs\\node\\node_modules\\npm\\bin\\npm-cli.js',1 verbose cli 'install',1 verbose cli...

解决webstorm创建vue项目报错:

  1. 报错如下:

    0 info it worked if it ends with ok
    1 verbose cli [
    1 verbose cli   'D:\\Work Programs\\node\\node.exe',
    1 verbose cli   'D:\\Work Programs\\node\\node_modules\\npm\\bin\\npm-cli.js',
    1 verbose cli   'install',
    1 verbose cli   '@vue/cli@latest',
    1 verbose cli   '--global',
    1 verbose cli   '--prefix',
    1 verbose cli   'D:\\Work',
    1 verbose cli   'Programs\\node\\node_cache\\_npx\\7400',
    1 verbose cli   '--loglevel',
    1 verbose cli   'error',
    1 verbose cli   '--json'
    1 verbose cli ]
    2 info using npm@6.14.5
    3 info using node@v12.18.2
    4 verbose npm-session 72282d2d1faa409e
    5 silly install loadCurrentTree
    6 silly install readGlobalPackageData
    7 silly fetchPackageMetaData error for file:Programs\node\node_cache\_npx\7400 Could not install from "Programs\node\node_cache\_npx\7400" as it does not contain a package.json file.
    8 http fetch GET 200 https://registry.npm.taobao.org/@vue%2fcli 305ms
    9 silly pacote tag manifest for @vue/cli@latest fetched in 335ms
    10 timing stage:rollbackFailedOptional Completed in 0ms
    11 timing stage:runTopLevelLifecycles Completed in 343ms
    12 verbose stack Error: ENOENT: no such file or directory, open 'D:\Projects\WebstormProjects\untitled\Programs\node\node_cache\_npx\7400\package.json'
    13 verbose cwd D:\Projects\WebstormProjects\untitled
    14 verbose Windows_NT 10.0.19041
    15 verbose argv "D:\\Work Programs\\node\\node.exe" "D:\\Work Programs\\node\\node_modules\\npm\\bin\\npm-cli.js" "install" "@vue/cli@latest" "--global" "--prefix" "D:\\Work" "Programs\\node\\node_cache\\_npx\\7400" "--loglevel" "error" "--json"
    16 verbose node v12.18.2
    17 verbose npm  v6.14.5
    18 error code ENOLOCAL
    19 error Could not install from "Programs\node\node_cache\_npx\7400" as it does not contain a package.json file.
    20 verbose exit [ 1, true ]
    
  2. 仔细查看日志,发现如下日志Programs\node\node_cache\_npx\7400路径不全,我们的node_cache配置的是D:\Work Program\node\node_cache因此推测可能是由于文件夹命名中有空格导致的问题。

    Could not install from "Programs\node\node_cache\_npx\7400" as it does not contain a package.json file.
    
  3. 原因找到了,我们需要重新安装node,并禁止node的安装目录路径中的文件夹有类似Work Program包含空格的文件夹。

    个人认为这个应该是node或者vue-cli的一个bug,后期应该能通过升级解决问题。

本文地址:https://blog.csdn.net/xuanwoa/article/details/107294298