I'm trying to publish my Vue component(s) to NPM but I'm running into some issues.
I followed these instructions: https://www.xiegerts.com/post/creating-vue-component-library-structure/
My structure is as follows:
The package is published here: https://www.npmjs.com/package/bootstrap-vue-formgenerator
Now, when I install my package using NPM and try to use it, it cannot find it. Webstorm also underlines the name of the package telling me the module has not been installed.
What am I doing wrong here?
Related
I am using Expo Snack but keep receiving an error when using the public npm package below. I can access the package, use it locally in my app, but through Expo Snacks, the error below happens. Any idea about it?
Failed to resolve dependency '#proximus/react-native-language-translation#^2.1.3' (Package '#proximus/react-native-language-translation' not found in the registry)
A search for that package on npm shows it has not been updated in three years and it's build status is not going through.
It is a curious case as to how it works for you locally. I couldn't download the package on my end, using either npm or yarn.
Why not use a better library for what you are trying to do, like react-native-localize
I'm trying to run a simple hello.ts script from command line. This works if the script has no dependencies:
npx ts-node hello.ts
But as soon as I start adding some dependencies...
import _ from 'lodash';
console.log('hello');
It fails:
Cannot find module 'lodash' or its corresponding type declarations.
It keeps failing even if I install the dependencies globally. So how do I tell npx (or ts-node for that matter) to consider globally installed dependencies?
Update
Using Node 16.9.1 (upgraded via Version Lens). The error seems to have disappeared after uninstalling/reinstalling the imported libraries a few times.
If you're using npm >=1.0, you can use npm link to create a local link to a package already installed globally. (Caveat: The OS must support symlinks.)
IE: npm install -g lodash && npm link lodash
However, this doesn't come without its problems.
npm link is a development tool. It's awesome for managing packages on your local development box. But deploying with npm link is basically asking for problems, since it makes it super easy to update things without realizing it.
As an alternative, you can install the packages locally as well as globally.
For additional information, see:
https://nodejs.org/en/blog/npm/npm-1-0-link/
https://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation/
Are you using the n package by any chance? I used n to change from a newer version of node (16.2.0) to an older version of node (12.13.0), ran npm i and npx failed with a different error.
Using n to change back to 16.2.0 seems to have resolved the issue so I'm thinking perhaps it was an issue with package-lock.json or such
I am creating a stencil project which uses an npm package inside it, is there any options to add an npm package inside stencil project. Any suggestions I searching for a solution for quite a while.
This is how i use ck-editor in angular
<ck-editor name="editor" #myEditor [(ngModel)]="templateSetValue.template_content"
(change)="handleEditorData($event)">
</ck-editor>
Is it possible to use the same is stencil project
https://www.npmjs.com/package/ngx-ckeditor
Not sure if I understood the question correctly, but to add a package from npm in your Stencil.js project, you can just install it, like you would in any other node project:
npm install <some-package>
For example nprogress:
npm install nprogress #types/nprogress
and then import it in your code like
import nprogress from 'nprogress';
nprogress.start();
// ...
I have just started using yarn and I can't figure out how to link a globally installed package to a project. With npm I would just run npm link <package-name> but it doesn't work with yarn.
when I run yarn link <package-name> it gives this error:
yarn link v1.22.4
error No registered package found called "express".
info Visit https://yarnpkg.com/en/docs/cli/link for documentation about this command.
The link functionality is not really meant for linking global packages to a project. It is meant to link a package that you are working on to another project that you are working on. The fact, that the npm link command can be used to link globally installed packages to the current project is just an implementation detail of npm. From the yarn docs:
For the vast majority of packages it is considered a bad practice to have global dependencies because they are implicit. It is much better to add all of your dependencies locally so that they are explicit and anyone else using your project gets the same set of dependencies.
So you should just add the dependencies via yarn add <package-name>.
I'm using npm link to change my private package and see changes in action in another project. The problem is that both my projects use graphql as a dependency so I get an error Cannot use GraphQLSchema "[object GraphQLSchema]" I was trying to use resolutions key in package.json of my main project. Unfortunately it didn't help. So, I'm clueless about how to resolve this issue without pushing a newer version of my package to npm
To get around this do the following
npm i -g graphql
For each dependant project, inside the working directory
npm link graphql
This will connect to the globally installed graphql for each project and allow you to share the module without the shared directory structure