How to install simple plain Javascript autocompletion in NeoVIM using yarn? - hadoop-yarn

So I want to install JavaScript support as I have already installed coc.nvim plug-in and node.js, but the nvim says the following:
So I do the following:
I create .config/nvim/plugged/coc.nvim (Because plugged folder was not created)
Inside coc.nvim I type: sudo npm install -g yarn
yarn install
yarn build
Now, It says: error Couldn't find a package.json file in "/home/dru7/.config/nvim/plugged/coc.nvim"
So I type yarn add javascript - PACKAGE NO LONGER SUPPORTED
7)I can delete everything inside coc.nvim and I want to install correct dependency, how?
So how do I add simple autocompletion ( for Javascript into an empty coc.nvim file?

Related

Yarn Installation not brings Vue files

As a newbie, i am trying to properly install yarn via VsCode terminal, and having an issue;
I use
yarn add -g #vue/cli
command to install, after installation i am still not able to use vue ui command(throws: the term ‘vue’ is not recognized as the name of a cmdlet…’), so it made me think of the vue.cmd not installed in my system, then i check my npm directory, i can see 3 different yarn files, but no vue files at all..
I have been using npm before and already uninstalled before yarn installation, with following command:
npm uninstall -g #vue/cli
After uninstalling npm, the vue files in npm directory are gone, as expected.
Is there any other step that I should take to install vue.cmd files(if its necessary)?
Maybe i should not have to uninstall npm, becacuse npm installation brings vue files into my system?
Thank you in advance,
Instead of using:
yarn add -g #vue/cli
Use this command:
yarn global add #vue/cli
Note: If you are on windows you have to use CMD to run vue cli commands. As by default PowerShell doesn't allow to run packages that were installed globally via npm or yarn. You may need to disable PowerShell security to use that package in PowerShell. But I recommend you to use cmd to use the package after installation. But still, you can install the package via PowerShell.

Upgrade/update a node package in package.json without installing it?

This question applies to either npm or yarn and I would like to know if what I need to do can be done with one or the other or both. For the sake of clarity I will only refer to yarn commands as I would prefer the yarn solution.
I have a bash script where I conditionally yarn upgrade a node package that is guaranteed to be in the package.json file but has not yet been installed. I would like to potentially reduce the number of times I call yarn install. As it stands I need to call yarn install and then yarn upgrade but I don't need to because I will be calling yarn install later in the script.
I think I can save a call to yarn install (via a yarn upgrade) in my script by simply updating the version number for the node package I want upgraded in package.json but then do not actually install any of those files since I will be calling yarn install at a later time in the script.
I would simply like to change the version number of a specific node package without installing any files using either a yarn or npm command. If this is not possible is this a good use case to parse package.json by hand and insert the version number with brute force?
Dependencies can be added to your package.json without installing them by using npm-add-dependencies
You can use it on-they-fly via npx, for example:
npx add-dependencies browser-sync-webpack-plugin#^2 browser-sync#^2 --dev
This will add browser-sync-webpack-plugin version ^2 and browser-sync version 2^ to devDependencies in your package.json

Is there any difference between installing global packages with Yarn or NPM?

Does it matter whether you install a global package with yarn global add PACKAGE vs npm install -g PACKAGE ?
Is there any difference at all, like where files are installed?
If yes, what is it?
So yes, you are right it is different. For npm it is something like below
/Users/tarunlalwani/.nvm/versions/node/v9.2.0/lib if you are using nvm
You can get this path using
$ npm config get prefix
/Users/tarunlalwani/.nvm/versions/node/v9.2.0
Where does npm install packages?
While yarn uses other paths
Windows: %LOCALAPPDATA%/Yarn/config/global
OSX and Linux non-root: ~/.config/yarn/global
Linux if logged in as root: /usr/local/share/.config/yarn/global
How to display yarn globally installed packages?
See this thread as well
https://github.com/yarnpkg/yarn/issues/2049
This is the document about Yarn global
yarn global is a prefix used for a number of commands like add, bin,
list and remove. They behave identically to their normal versions
except that they use a global directory to store packages. The global
command makes executables available to use on your operating system
and this is the document about npm install global mode
In global mode (ie, with -g or --global appended to the command), it
installs the current package context (ie, the current working
directory) as a global package.
I think there is no difference between them. Install a package as a global useful for developer tooling that is not part of any individual project but instead is used for local commands

Why does coffeescript need to be installed globally?

I have a jenkins build that is failing with the following error:
+ npm install
npm WARN prefer global coffee-script#1.12.4 should be installed with -g
Curious as to why coffee-script, or any package for that matter, needs to be installed globally?
Because coffeescript is a command line tool which can transpile coffeescript into javascript, or run as as an interactive shell similar to node.
from the NPMJS docs:
There are two ways to install npm packages: locally or globally. You choose which kind of installation to use based on how you want to use the package.
If you want to use it as a command line tool, something like the grunt CLI, then you want to install it globally. On the other hand, if you want to depend on the package from your own module using something like Node's require, then you want to install locally.
It would technically be possible to install these CLI packages locally, but then you would have to run them using a relative path such as(untested):
./node_modules/coffeescript/bin/coffeescript

Install extension in Yii2

Hi can someone show me steps how can I install fabric.js in yii2 project? This is Fabric.js: link to github
There I can see that I can install fabric.js only by bower or npm. I don know that i have bower on start in Yii2 procejct or I should I install this bower. Now I only used composer install and update. And I dont know how to install this in my project. Maybe anyone can show me easiest way to install this by composer only or other easy way? I tried to write command :
bower install fabric
but i have error:
bash: bower: command not found
Make sure you have got Composer asset plugin installed. If not run console command:
composer global require "fxp/composer-asset-plugin:^1.2.0"
All you have to do now is to add in require section of composer.json
"bower-asset/fabric": "*"
and run composer update command in console (in the project folder).