NPM run dev successful in vscode but not terminal (contenlayer + Nextjs) - npm

I am a bit at a loss on this one. Everything in my terminal (hyper) was working just fine the other day until I closed out of it. I came in to launch a Nextjs app I had been working on and now npm run dev just hangs up and doesn't actually start. The strange thing (to me) is that Visual Studio Code's integrated terminal seems to run just fine (and much quicker).
So far, the only packages I have added are contentlayer and next-contentlayer besides the default nextjs packages. Basically, contentlayer looks for md files (in a difined dir) and then generates an api for them. Strangely this seems to work everywhere else but in my actual standalone terminal.
Hyper.js:
Visual Studio code integrated terminal:
I have found that if I remove makeSource from the contentlayer.config.ts file, next dev will still run. At this point I could just use vscode, but I would really like to figure out the issue on all of this.

Related

Svelte hot reload compiles several times (2-4 times) after each save (npm run dev)

I'm using Visual Studio Code and its Terminal function on a Mac (Mini, M1) for learning svelte.
I'm doing svelte's tutorial (https://svelte.dev/tutorial/basics) and running "npm run dev" in terminal for hot reload. Everything works as it should, no errors so far.
Problem: Unfortunately, after each save, svelte is being compiled several times. This forces the browser to refresh several times which makes working uncomfortable.
Unfortunately, I don't know how and where to start troubleshooting. There are no errors.

Visual Studio Code test sidebar button disappeared

I restarted VSCode because there were some problems with it, and now the test button on the left, the one that looks like a flask, has disappeared! I tried to run the command "Test: Run All Tests", but I get a message "No tests found in this workspace. You may need to install a test provider extension". Did I just accidentally uninstall test support in VSCode??? I can still run pytest from the command line and that works fine.
EDIT
Please read my own answer below.
OK I found out the problem myself. It seems that there is another Python executable on my Windows machine, which seems to have come with VSCode itself, at C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe. Somehow when I restarted VSCode, that Python executable was selected, and it didn't have pytest or even unittest or anything I don't think, so I guess VSCode saw that there was no testing capability at all and didn't bother showing the test button. It seems insane that VSCode comes with its own Python executable though, I wonder why that is.
EDIT
Oh oops it's Visual Studio that came with the Python executable, not VSCode, obviously as the path suggests. My bad.

VS Code does not launch a web browser when starting Live Server or "npm start" with React

I'm using Visual Studio Code Insiders on Arch Linux (installed via snapstore), and whenever I try to "open with live server", no browser launches. I can manually go to the local domain myself and its running, however it is annoying how it doesn't work out of the box. Same thing happens when using a react app, except it shows a link to follow in the integrated terminal.
It's not the biggest of deals, but it is annoying me because I do remember a time when Firefox was my default browser (fresh Arch install) and I was not having that problem.
Maybe I messed up something in the VS Code user settings but I cant remember... any tips to fix this hiccup would be much appreciated!
also the same thing happened with VS Code Insiders-git and bin from the AUR. Installing other versions and other repos didn't help.

Can't see or publish packages with Verdaccio

I’m fairly new to Verdaccio. Been familiar with the tool for quite some time, but this is my first time trying to use it. I’ve installed it locally for the purpose of trying to figure out the right syntax for handling versioning, tagging and publishing a shared component library for work, but I’m having trouble getting this package published to my locally running instance of Verdaccio, and I’m struggling to understand why the publish command is failing. Was hoping someone here might be able to help.
First off, I should say that I have it installed and running locally, I can browse to http://localhost:7890 and see the Verdaccio web UI, and it says that I have “No package published yet.” That makes sense, because I haven’t been able to successfully publish anything yet. I’ve created a user with the npm adduser —registry http://localhost:7890 command, and then after that I ran the following command to attempt to publish to it: npm publish —access public —registry http://localhost:7890. When I run this command, I get the following error: “EPUBLISHCONFLICT … Cannot publish over existing version.”
Now, I can in fact see, when I look in .local/share/verdaccio/storage that there is a folder for the scope that I published with, and in that folder, there is a folder for the package that I apparently published, and it only has a package.json file in it. I’ve attempted to wipe this all clean, reinstall Verdaccio, etc, etc, nothing seems to fix the issue. I can’t seem to make this package go away, OR to get it to display in the UI either. After publishing (unsuccessfully), and despite the face that it says this version of the package exists, I still see nothing in the UI. It still just says “No package published yet”, which I still don’t really understand.
Any ideas would be appreciated. This has me pretty stumped. Thanks.
Add your package.json name as npm registry (it needs the same one you published the last time).
I was getting this issue:
The following works for me:
npm publish --registry=http://yourhost:yourport

Loss of developer ergonomics after packaging code as library

I have made a few applications (using webpack, babel, react, d3, npm etc.) that uses very similar charting code. I am in the process of splitting out that charting code into an npm package which multiple apps can then import.
To test this out, I've embedded a demo app inside my chart libraries project directory and install the library at its file path. Now, presumably i'll be able to install this in depending apps A, B and C and so on, and I can change my chart libary and all apps will reflect these changes.
The first thing I noticed is that I now have to cd into my chart library and run npm run build (which runs webpack) any time I change something, and then cd into the depending app I'm working on and run npm i. This can perhaps be improved by using npm link but there are issues there as well (such as versioning and deploying to my server). So my first question is about what a decent rapid development approach looks like now that my charting code is in a separate npm project.
The other problem I've noticed is that I've lost two valuable features with respect to my chart library code. Code completion in VSCode and debugging in chrome dev tools. I'm not sure why VSCode code completion has stopped working. And for debugging, how would i be able to debug both my depending app and the library its depending on at the same time in chrome?
I would use npm link. It's immensely helpful when working on a library and its integration side by side.
Check the Chrome settings to make sure it's not instructed to skip libraries in Settings -> Framework Blackboxing, see e.g., http://blog.edenhauser.com/tell-chrome-debugger-to-ignore-libraries/.