Verdaccio No Package Published Yet - npm

From today verdaccio (v3.8.3) stopped showing packages in local registry.
Opening on browser this message is shown: No Package Published Yet
The storage folder specified in configuration (~/.local/share/verdaccio/storage) contains all my packages.
But database file is empty ~/.local/share/verdaccio/storage/.sinopia-db.json.
Indeed running verdaccio from terminal I get this:
warn --- config file - /home/bssadmin/.config/verdaccio/config.yaml
error--- Package database file corrupted (invalid JSON), please check the error printed below.
File Path: /home/bssadmin/.local/share/verdaccio/storage/.sinopia-db.json SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at LocalDatabase._parseDatabase (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/node_modules/#verdaccio/local-storage/lib/local-database.js:298:19)
at LocalDatabase._fetchLocalPackages (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/node_modules/#verdaccio/local-storage/lib/local-database.js:272:23)
at new LocalDatabase (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/node_modules/#verdaccio/local-storage/lib/local-database.js:49:22)
at LocalStorage._loadStorage (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/build/lib/local-storage.js:809:14)
at new LocalStorage (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/build/lib/local-storage.js:54:27)
at Storage.init (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/build/lib/storage.js:64:25)
at /home/bssadmin/.npm-packages/lib/node_modules/verdaccio/build/api/index.js:145:19
at Generator.next (<anonymous>)
at step (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/build/api/index.js:53:191)
error--- Database is locked, please check error message printed during startup to prevent data loss.
(node:9242) ExperimentalWarning: The fs.promises API is experimental
error--- Database is locked, please check error message printed during startup to prevent data loss.
warn --- Plugin successfully loaded: htpasswd
warn --- Plugin successfully loaded: audit
warn --- http address - http://0.0.0.0:4873/ - verdaccio/3.8.3
What's happened? How can I resolve?
I should tag this question with 'verdaccio' tag but is not available and I can't create it.

If the .sinopia-db.json. is empty, pretty likely was corrupted. If there were any private packages you might need to fix it manually.
The format is pretty simple
{"list":["#test/test_1","#test/test_2","#test/test_3","test_4"],"secret":"secretKEYLongString"}
This file must be a valid JSON format.
If in the other had, the database was empty, just let the list array empty, or remove the whole file, restart the server and Verdaccio will generate a new one.

Related

VS code failed to load extensions and failed to install new extension after an update

Today I reopen my VS Code after several days, found the extensions that I installed and used for a long time disappeared totally, and it recommended me to install extension for java. OK, I followed the recommends to install extension, and failed.
I checked my Code version, it's the latest version surely.
Then I dipped into the log and tried to install some other extensions, and found the failure always related to one js file sharedProcessMain.js. The detail log is as following:
2023-02-16 09:32:06.725 [error] SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at Object.factory (vscode-file://vscode-app/d:/Users/MI/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:88:93520)
2023-02-16 09:32:06.771 [error] Unexpected end of JSON input: SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at Object.factory (vscode-file://vscode-app/d:/Users/MI/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:88:93520)
If anyone who can provide any suggestion? Thank you very much!
On what OS are you running?
I use Windows and I faced the same problem yesterday. Solved it by
Closing VSCode
Removing the entire folder %appdata%\Code
Removing the entire folder %userprofile%\.vscode
Starting VSCode
Hope this helps.

how to solve module build failed after changing file extension ( *.ts => *.tsx )?

after changing a specific file's extension from .ts to .tsx I get:
Compiled with problems:X
ERROR in ./src/components/SomeComp/someFile.ts
Module build failed (from ./node_modules/source-map-loader/dist/cjs.js):
Error: ENOENT: no such file or directory, open '.../someFile.ts'
ERROR
No files matching 'C:\Users...\src\components\SomeComp\someFile.ts' were found.
it has happened recently and somehow figured out on its own,
then i switched branches and when returned it happened again
I tried what was suggested here, clearing the browser cache How to get Chrome to reload source maps?
also restarted the react dev server couple of times
but still it tries to find the file with the old .ts extension...
searched as much as I could but didn't find a solve...
edit:
after changing the extension back and forth and restarting the dev server it has figured out, but I would still love to know what was happening and what perhaps what should be done to handle this situation correctly in the future

Vue 3 browser caching doesnt pick latest files

We have a build.js code in our project which makes a duplicate of our client directory and adds a folder inside src.
example -
client/src/components will become dist/src/abcxy/components
abcxy will change every time we create a new build.
Now the problem is that the browser tries to find the old dist files from the cache and is unable to find them, instead of finding new files it gives an error in the console.
The error changes depending on the browser I am using
EXAMPLE ERROR - Failed to load ‘http://localhost/src/pbtsg/components/report/reports.js’. A ServiceWorker intercepted the request and encountered an unexpected error.

Connection to flow server got closed. See the output for more information

I got this error message when using React Native on vscode. Is there a way to fix it?
[Error - 2:57:25 PM - MyRealmApp\.flowconfig] Error loading flow using option 'useNPMPackagedFlow'
Pkg flow-bin not found in c:\Users\ReactNativeProjects\MyRealmApp
[Error - 2:57:25 PM - MyRealmApp\.flowconfig] Error loading flow using option 'pathToFlow'
'flow' not found
[Info - 2:57:25 PM - MyRealmApp\.flowconfig] Falling back to bundled flow.
[Info - 2:57:27 PM - MyRealmApp\.flowconfig] Using flow 'c:\Users\.vscode\extensions\flowtype.flow-for-vscode-1.9.2\node_modules\flow-bin\flow-win64-v0.107.0\flow.exe' (v0.107.0)
.flowconfig:28 Unsupported option specified! (format.bracket_spacing)
[Error - 2:57:28 PM] Connection to server got closed. Server will not be restarted.
Basically this issue was caused by not having installed the same version of flow-bin as declared in the .flowconfig of the projects.
Now what you have to do to fix that, is to maintain coherence in the current .flowconfig of the project in your VS Code.
How to do that?
You can just do the below thing and it will fix your issue. If you don't have a yarn, then use npm in place of yarn.
yarn global add flow-bin#version
npm run ios or npm run android
The above will help you fix the issue, but you will always have to check whether they are getting pointed to the same version. In order to fix it stably, you can do the following:
In your VS Code settings you need to point flow.pathToFlow to your workspace node_module:
// settings.json
{
"flow.pathToFlow": "${workspaceFolder}/node_modules/.bin/flow",
}
${workspaceFolder} is a special variable provided by VS Code and it always points to the current project folder. You can find it in the variables reference page of the official docs.
You can prefer to use the local Flow module because this way you can ensure that the installed version and the configured one in .flowconfig always match even when you switch projects.
There is an extra setting for that: flow.useNPMPackagedFlow, just set it to true and you are done (no need to change flow.pathToFlow)

“Page Not Found” when navigating to site created with Gridsome & deployed on Netlify

I've created a new site using Gridsome deployed with Netlify, but I can't get the site to appear when accessed. Instead, Netlify says:
Page Not Found
Looks like you've followed a broken link or entered a URL that doesn't exist on this site.
< Back to our site
I tried updating my build settings based on the instructions of the creator of the Gridsome starter template I'm using, but the site still doesn't display. I've also updated the js-yaml version.
I've gone through the questions/answers for similar questions on here, but I haven't been able to figure this out. I'm new to web development, and I'm sure I'm missing one or more things contributing to the issue.
My GitHub repo for this site.
The site.
I have the build log from Netlify. There are some errors in it. I don't want to put too much here, so here's a part from the end of the log.
12:18:36 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
12:18:36 PM: Error running command: Build script returned non-zero exit code: 1
12:18:36 PM: Failing build: Failed to build site
12:18:36 PM: Finished processing build request in 55.729813394s
A Gist for the whole build log.
Thanks so much for your help, #talves!
I was having trouble using the build commands because of being new to cli stuff and a permissions issue. I asked a friend about the build errors I was getting from Netlify, and he recommended I try removing and re-installing my node modules. Did that, still didn't work. I tried removing anything in the repo having to do with "journal" since Failed to render /journal kept appearing in the build log, but that didn't work either.
I googled ReferenceError: _objectSpread is not defined after update since that was in the build log after the journal error. I found a comment on an issue noting the same error message in the main Babel GitHub repo that suggested adding the following to the package.json file:
"resolutions": {
"#babel/core": "^7.5.4"
}
I added it, tried to build again, and it still failed but only gave me one error message it didn't show before—Error: SyntaxError: Unexpected string in JSON at position. I googled that message and got another issue on GitHub. A comment on the issue noted a missing comma.
I went back to my package.json file and found that I didn't add a comma to the bracket above the new "resolutions" snippet. I added the comma, tried to build again, and it worked 🤜💥✨ !
Sorry if this is long-winded! I thought it might be good to include my process on figuring this out in case others run into the same issues.