I am testing a module built for vuejs, but there is an annoying warning that I think I know how to solve (it's cited on its issues on github). I also tried with a console.log just to be sure.
I tried to correct it inside node_modules src directory but I fail to understand how to recompile it and use in my project. npm rebuild doesn't do anything and if I delete the "dist" directory of the module, nothing happens as well.
How could I do that? Should I wait and hope that the original author correct it? I'm just testing the module, I am not sure I am going to use it.
This is the repo: https://github.com/kamil-lip/bootstrap-vue-treeview
Related
I run into this problem pretty frequently while developing react applications. The latest is hwid. I am using yarn to manage dependencies.
I added the module using
yarn add hwid
It added it to the package.json file and gave me no errors. When I run the application, it says it is unable to find the module. The module is there in node_modules and everything seems to be correct and in place. So I tried deleting node_modules and running yarn install. I've done this several times. I tried force cleaning the npm cache. I have run yarn remove and yarn add several times.
I am using the WebStorm IDE. It gives me no errors, and in fact, if I let it resolve the import, it finds it just fine. This seems to only happen to me in react projects. I think, but I'm not sure, that it is usually typescript modules that give me problems.
Is there a magic bullet for this? The module is a pretty critical part of my app, so if I can't resolve it using node and react's import system, I'm going to have to just copy the files into my project. I would really rather not do that for obvious reasons.
Any help is appreciated.
If it's about typescript modules, have you tries also installing types of that modulea?
E.g.yarn add #types/hwid
I am studying an aplication that has some dependencies. I want to make some changes on one dependency locally.
I tryed to make a symbolic link inside the main application's node_modules direct to the dependency folder, where I have the folders with compiled code (es and lib) using this command ln -s dependency_folder main_app/node_modules/dependecy.
It doesn't work and raises an error:
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/warnings/invalid-hook-call-warning.html for tips about how to debug and fix this problem.
Is this a right way to develop a dependency package, or I am doing it wrong.
I realize that there is no problem to link to a dependency package. What happened here is that the project source files are out of date. Compiled dependencies are up to date on NPM, on git the sources are outdated.
i will leave this message just for the records.
I'm trying to write an npm package that will be published and used as a framework in other projects. The problem is -- I can't figure out a solid workflow for working on it at the same time as working on projects that depend on it.
I know this seems super basic and that npm link solves the issue, but this is a bigger one than just being able to import one local package from another.
I have my framework package scaffolded out; let's call it gumby, It exports a function that does console.log('hello from gumby'). That's all that matters for right now.
Now I'm ready to create a project that will use gumby. Let's call this one client. I set that up too and npm link gumby so client can import from it, etc. OK cool, it's working as expected.
So now it's time to publish gumby. I run npm publish and it goes out to npm as version 0.0.1.
At this point, how do I get the published, npm-hosted version of gumby into the package.json for client? I mean, I could just delete the symlinked copy from my node_modules and then yarn add gumby, but what if I want to go back and work on it locally again? And then run it against the npm version again? And then work on it some more? And then...
You get the point, I imagine. There's no obvious way to switch between the npm copy of a package that you're working on, and the local one. There's the additional problem of how to do that without messing with your package.json too much, e.g. what if I accidentally commit to it version control with some weird file:// dependency path. Any suggestions would be much appreciated.
For local development, having the package symlinked is definitely the way to go, the idea of constantly publishing / re-installing the package sounds like a total pain.
The real issue sounds more like you’re concerned about committing a dev configuration to prod - you could address that problem with something as simple as a pre-commit hook on your VCS e.g. block if it detects any local file references in the package.json.
Hello and thanks for reading,
Historically, when I ran the command:
npm install module
Module would install in the node_modules dir of the current working directory. This still happens, however, the modules that the module use, is now installing alongside the original module, so that my node_modules dir might look like:
./node_modules/module/
./node_modules/module-of-that-module/
When it used to look like:
./node_modules/module/node_modules/module-of-that-module/
I suppose it might boil down to preference, but I don't really like the sub-modules installing alongside the main module I was trying to install, as my main node_modules directory became cluttered with hundreds of random modules fast. Also it seems kind of strange for the structure to be this way if the modules of modules need different versions.
Can anyone please explain what changed here? And how I might change it back? I tried to find a solution prior to writing this, but it's unclear to me how to search around this issue or what category it falls under.
I'm experiencing something weird.
I have a node project that uses an external module imported with npm into the node_modules directory.
Now I am making a change in the node module code and when I run my app the change doesn't kick in (I know because i've put console.log() there).
Am I missing something here ? Does node caches it's modules somehow ? Or does it sound like something local ?
Thanks.
This should definitely work.
However, if the same module is also included as a dependency of an other module, it would be inside the node_modules of that module. And if that's the one being used, this is the one you would need to change.