vuepress / vp-update Goto Github PK
View Code? Open in Web Editor NEWUpdate helper for VuePress2
Update helper for VuePress2
when I use yarn dlx vp-update
to update vuepress,it said 'Couldn't find a configuration settings named "registry"'
the version of yarn is:
3.6.3
and the error as follow:
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 25s 652ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ rxjs@npm:7.8.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ tmp@npm:0.0.33 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ type-fest@npm:0.21.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ vp-update@npm:0.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ wcwidth@npm:1.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 1s 105ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: └ Completed
➤ YN0000: Done with warnings in 26s 833ms
Upgrading current project...
file:///root/.yarn/berry/cache/execa-npm-7.2.0-7797cafb24-8.zip/node_modules/execa/lib/error.js:60
error = new Error(message);
^
Error: Command failed with exit code 1: yarn config get registry
Usage Error: Couldn't find a configuration settings named "registry"
$ yarn config get [--json] [--no-redacted] <name>
at makeError (file:///root/.yarn/berry/cache/execa-npm-7.2.0-7797cafb24-8.zip/node_modules/execa/lib/error.js:60:11)
at execaSync (file:///root/.yarn/berry/cache/execa-npm-7.2.0-7797cafb24-8.zip/node_modules/execa/index.js:201:17)
at execaCommandSync (file:///root/.yarn/berry/cache/execa-npm-7.2.0-7797cafb24-8.zip/node_modules/execa/index.js:276:9)
at O (file:///root/.yarn/berry/cache/vp-update-npm-0.2.0-57fd61b50e-8.zip/node_modules/vp-update/lib/index.js:2:1448)
at U (file:///root/.yarn/berry/cache/vp-update-npm-0.2.0-57fd61b50e-8.zip/node_modules/vp-update/lib/index.js:2:1499)
at CAC.<anonymous> (file:///root/.yarn/berry/cache/vp-update-npm-0.2.0-57fd61b50e-8.zip/node_modules/vp-update/lib/index.js:3:605)
at CAC.runMatchedCommand (file:///root/.yarn/berry/cache/cac-npm-6.7.14-c46284e425-8.zip/node_modules/cac/dist/index.mjs:610:34)
at CAC.parse (file:///root/.yarn/berry/cache/cac-npm-6.7.14-c46284e425-8.zip/node_modules/cac/dist/index.mjs:537:12)
at file:///root/.yarn/berry/cache/vp-update-npm-0.2.0-57fd61b50e-8.zip/node_modules/vp-update/lib/index.js:4:319
at ModuleJob.run (node:internal/modules/esm/module_job:194:25) {
shortMessage: 'Command failed with exit code 1: yarn config get registry',
command: 'yarn config get registry',
escapedCommand: 'yarn config get registry',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: `\x1B[31m\x1B[1mUsage Error\x1B[22m\x1B[39m: Couldn't find a configuration settings named "registry"\n` +
'\n' +
'\x1B[1m$ \x1B[22myarn config get [--json] [--no-redacted] <name>',
stderr: '',
cwd: '/root/code/vuepress-blog',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
Node.js v18.16.1
After I mondify the yarn config get registry
to yarn config get npmRegistryServer
in vp-update-npm-0.2.0-57fd61b50e-8.zip,It can work success。
my yarn config as follow:
➤ YN0000: npmPublishAccess null
➤ YN0000: npmPublishRegistry null
➤ YN0000: npmRegistries Map(0) {}
➤ YN0000: npmRegistryServer 'https://registry.npmmirror.com/'
➤ YN0000: npmScopes Map(0) {}
➤ YN0000: packageExtensions Map(0) {}
I use npx vp-update
to upgrade my site which is built with VuePress 2 and vuepress-theme-hope .
Here is the error message:
/Users/xxx/.npm/_npx/d0044b51b4805856/node_modules/.bin/vp-update: line 1: syntax error near unexpected token `('
/Users/xxx/.npm/_npx/d0044b51b4805856/node_modules/.bin/vp-update: line 1: `import{existsSync as a,readFileSync as b,writeFileSync as A}from"node:fs";import{resolve as i,dirname as f}from"node:path";import{cac as E}from"cac";import{execaCommandSync as d}from"execa";import{createRequire as I}from"node:module";import{get as j}from"node:https";import C from"semver";const F=["@vue/compiler-core","@vue/compiler-dom","@vue/compiler-sfc","@vue/compiler-ssr","@vue/devtools-api","@vue/reactivity","@vue/reactivity-transform","@vue/runtime-core","@vue/runtime-dom","@vue/server-renderer","@vue/shared","vue","vue-router"],_=["@vuepress/bundler-vite","@vuepress/bundler-webpack","@vuepress/cli","@vuepress/client","@vuepress/core","@vuepress/markdown","@vuepress/shared","@vuepress/utils","vuepress","vuepress-webpack","vuepress-vite"],R=["@vuepress/plugin-active-header-links","@vuepress/plugin-back-to-top","@vuepress/plugin-container","@vuepress/plugin-docsearch","@vuepress/plugin-external-link-icon","@vuepress/plugin-git","@vuepress/plugin-google-analytics","@vuepress/plugin-medium-zoom","@vuepress/plugin-nprogress","@vuepress/plugin-palette","@vuepress/plugin-prismjs","@vuepress/plugin-pwa","@vuepress/plugin-pwa-popup","@vuepress/plugin-register-components","@vuepress/plugin-search","@vuepress/plugin-shiki","@vuepress/plugin-theme-data","@vuepress/plugin-toc"],T=/^(@.*\/)?vuepress-plugin-/,G=/^(@.*\/)?vuepress-theme-/,L=I(import.meta.url)("vp-update/package.json").version,y=new Map,u=new Map,w="package-lock.json",k="yarn.lock",h="pnpm-lock.yaml",N=e=>{try{return d(`${e} --version`).exitCode===0}catch{return!1}},$=e=>{const r=`global:${e}`,s=y.get(r);return s!==void 0?s:N(e)?(y.set(r,!0),!0):!1},O=(e=process.cwd(),r=!0)=>{const s=`local:${e}`,t=u.get(s);if(t!==void 0)return t;if(a(i(e,h)))return u.set(s,"pnpm"),"pnpm";if(a(i(e,k)))return u.set(s,"yarn"),"yarn";if(a(i(e,w)))return u.set(s,"npm"),"npm";if(r){let n=e;for(;n!==f(n);){if(n=f(n),a(i(n,h)))return u.set(s,"pnpm"),"pnpm";if(a(i(n,k)))return u.set(s,"yarn"),"yarn";if(a(i(n,w)))return u.set(s,"npm"),"npm"}}return null},P=(e=process.cwd(),r=!1)=>O(e,r)||($("pnpm")?"pnpm":$("yarn")?"yarn":"npm"),D=()=>d(`${P()} config get registry`).stdout.replace(/\/?$/,"/"),v=async(e,r="auto",s=3)=>{const t=`${D()}-/package/${e}/dist-tags`,n=()=>new Promise((c,l)=>{j(t,o=>{if(o.statusCode===200){let g="";o.on("data",S=>g+=S),o.on("end",()=>{c(JSON.parse(g))})}else l()}).on("error",l)});let p=1;do{const c=await n().catch(()=>{console.log(`Get ${e} version failed, [${p}/${s}]`)});if(c){const{next:l,latest:o}=c;return r==="latest"?o:r==="next"||l&&C.gt(l,o)?l:o}p++}while(p<=s);throw new Error(`Failed to get ${e} version!'
here is my package.json:
{
"type": "module",
"scripts": {
"docs:build": "vuepress build src",
"docs:clean-dev": "vuepress dev src --clean-cache",
"docs:dev": "vuepress dev src"
},
"devDependencies": {
"@vuepress/client": "2.0.0-beta.60",
"vue": "^3.2.45",
"vuepress": "2.0.0-beta.60",
"vuepress-plugin-search-pro": "^2.0.0-beta.168",
"vuepress-theme-hope": "2.0.0-beta.168"
}
}
my npm version: 8.11.0
Any tips on how to upgrade? How to get full error log?
Thank you for this awesome work!
I have been testing out bun lately and found issue that, whenever I ran bunx vp-update
, the actual package manager used to update the dependencies is still pnpm
, and it will create a new pnpm-lock.yaml
and may reinstall some of the dependencies as pnpm would.
I am wondering if there's any possibility or plan to add support for bun. I know bun is in its early stage, so I will not be surprised if this will not be done in the near future. Thank you again for this anyway!
执行更新的时候提示很多获取版本失败,重新创建项目也是一样,不知道是环境配置哪里出问题了
D:\Blog>pnpm docs:update-package
> [email protected] docs:update-package D:\Blog
> pnpm dlx vp-update
../.pnpm-store/v3/tmp/dlx-27768 | +77 ++++++++
../.pnpm-store/v3/tmp/dlx-27768 | Progress: resolved 77, reused 77, downloaded 0, added 77, done
Upgrading current project...
Get @vuepress/client version failed, [1/3]
Get vue version failed, [1/3]
Get vuepress version failed, [1/3]
Get vuepress-plugin-search-pro version failed, [1/3]
Get vuepress-theme-hope version failed, [1/3]
Get @vuepress/client version failed, [2/3]
Get vue version failed, [2/3]
Get vuepress version failed, [2/3]
Get vuepress-plugin-search-pro version failed, [2/3]
Get vuepress-theme-hope version failed, [2/3]
Get @vuepress/client version failed, [3/3]
Get vue version failed, [3/3]
Get vuepress version failed, [3/3]
Get vuepress-plugin-search-pro version failed, [3/3]
Get vuepress-theme-hope version failed, [3/3]
file:///D:/.pnpm-store/v3/tmp/dlx-27768/node_modules/.pnpm/[email protected]/node_modules/vp-update/lib/index.js:2
import{existsSync as a,readFileSync as b,writeFileSync as j}from"node:fs";import{resolve as i,dirname as f}from"node:path";import{cac as A}from"cac";import{execaCommandSync as d}from"execa";import{get as E}from"node:https";import I from"semver";import{createRequire as C}from"node:module";const F=["@vue/compiler-core","@vue/compiler-dom","@vue/compiler-sfc","@vue/compiler-ssr","@vue/devtools-api","@vue/reactivity","@vue/reactivity-transform","@vue/runtime-core","@vue/runtime-dom","@vue/server-renderer","@vue/shared","vue","vue-router"],_=["@vuepress/bundler-vite","@vuepress/bundler-webpack","@vuepress/cli","@vuepress/client","@vuepress/core","@vuepress/markdown","@vuepress/shared","@vuepress/utils","vuepress","vuepress-webpack","vuepress-vite"],R=["@vuepress/plugin-active-header-links","@vuepress/plugin-back-to-top","@vuepress/plugin-container","@vuepress/plugin-docsearch","@vuepress/plugin-external-link-icon","@vuepress/plugin-git","@vuepress/plugin-google-analytics","@vuepress/plugin-medium-zoom","@vuepress/plugin-nprogress","@vuepress/plugin-palette","@vuepress/plugin-prismjs","@vuepress/plugin-pwa","@vuepress/plugin-pwa-popup","@vuepress/plugin-register-components","@vuepress/plugin-search","@vuepress/plugin-shiki","@vuepress/plugin-theme-data","@vuepress/plugin-toc"],T=/^(@.*\/)?vuepress-plugin-/,G=/^(@.*\/)?vuepress-theme-/,L=C(import.meta.url)("vp-update/package.json").version,y=new Map,u=new Map,w="package-lock.json",k="yarn.lock",h="pnpm-lock.yaml",N=e=>{try{return d(`${e} --version`).exitCode===0}catch{return!1}},$=e=>{const r=`global:${e}`,s=y.get(r);return s!==void 0?s:N(e)?(y.set(r,!0),!0):!1},O=(e=process.cwd(),r=!0)=>{const s=`local:${e}`,t=u.get(s);if(t!==void 0)return t;if(a(i(e,h)))return u.set(s,"pnpm"),"pnpm";if(a(i(e,k)))return u.set(s,"yarn"),"yarn";if(a(i(e,w)))return u.set(s,"npm"),"npm";if(r){let n=e;for(;n!==f(n);){if(n=f(n),a(i(n,h)))return u.set(s,"pnpm"),"pnpm";if(a(i(n,k)))return u.set(s,"yarn"),"yarn";if(a(i(n,w)))return u.set(s,"npm"),"npm"}}return null},P=(e=process.cwd(),r=!1)=>O(e,r)||($("pnpm")?"pnpm":$("yarn")?"yarn":"npm"),U=()=>d(`${P()} config get registry`).stdout.replace(/\/?$/,"/"),v=async(e,r="auto",s=3)=>{const t=`${U()}-/package/${e}/dist-tags`,n=()=>new Promise((c,l)=>{E(t,o=>{if(o.statusCode===200){let g="";o.on("data",S=>g+=S),o.on("end",()=>{c(JSON.parse(g))})}else l()}).on("error",l)});let p=1;do{const c=await n().catch(()=>{console.log(`Get ${e} version failed, [${p}/${s}]`)});if(c){const{next:l,latest:o}=c;return r==="latest"?o:r==="next"||l&&I.gt(l,o)?l:o}p++}while(p<=s);throw new Error(`Failed to get ${e} version!
at async C:\Users\chanper\AppData\Local\node\corepack\pnpm\8.4.0\dist\pnpm.cjs:217149:7
ELIFECYCLE Command failed with exit code 1.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.