I am trying to install Less and Less-watch-compiler with Yarn. But I get a command not found when I check the lessc version.
I have OSX 10.11.6 El Capitan
I installed Yarn using Homebrew. I have Yarn version 1.9.4.
Then I used:
yarn global add less
This resulted in:
yarn global v1.9.4
[1/4] π Resolving packages...
[2/4] π Fetching packages...
warning Pattern ["less#^3.8.1"] is trying to unpack in the same destination "/Users/jem/Library/Caches/Yarn/v2/npm-less-3.8.1-f31758598ef5a1930dd4caefa9e4340641e71e1d" as pattern ["less#^3.0.4"]. This could result in non-deterministic behavior, skipping.
[----------------------------------------------------------------------------] 0/83(node:1407) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[3/4] π Linking dependencies...
[4/4] π Building fresh packages...
success Installed "less#3.8.1" with binaries:
- lessc
β¨ Done in 1.51s.
Then I used Yarn to get less-watch-compiler. Using the command:
yarn global add less-watch-compiler
That resulted in:
yarn global v1.9.4
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[-----------------------------------------------------------------------------------] 0/83(node:1597) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[3/4] π Linking dependencies...
[4/4] π Building fresh packages...
success Installed "less-watch-compiler#1.11.3" with binaries:
- less-watch-compiler
β¨ Done in 1.27s.
After doing this I checked the version of less by typing
lessc βversion. The result is:
-bash: lessc: command not found
In my ~/Library/Caches/Yarn/v2 directory I can see:
npm-less-3.8.1-f31758598ef5a1930dd4caefa9e4340641e71e1d
npm-less-watch-compiler-1.11.3-eb1fc62423898fae48fde1bed4968bb81bf220f2
Iβm not sure if this means that Less was installed.
I saw this question: lessc: command not found
It says I should Export the location of lessc into the PATH. But I need to know where lessc is? But Iβm not sure if the above items in the Cache file are the ones I need. Iβve tried removing node, yarn and nvm from my machine. Iβve removed and reinstalled yarn. But I get the same results each time.
Also, on my machine is another program called less. It's a unix page reader. http://www.greenwoodsoftware.com/less/
This has made things confusing.
Iβm new to this, and Iβve reached a dead end. Any help is appreciated.
Edit: I also tried to install yarn with npm.
sudo npm i -g yarn
sudo npm i -g less
sudo npm i -g less-watch-compiler
That didn't work either.
Also, when I look for lessc or less-watch-compiler using
$ which lessc
I don't get a response.
Related
I am running code in node 12. There are plans to upgrade, but this is not an option today. I am trying to do a yarn install but somewhere there is some dependency with a dependency of a dependency of camelcase 7.0.0 but, of course, this is not compatible with node 12. So I get
error camelcase#7.0.0: The engine "node" is incompatible with this module. Expected version ">=14.16". Got "12.22.12"
error Found incompatible module.
No yarn.lock is generated, so I can't see what is causing this. Is there a way to see what the yarn dependency tree would be before generating a yarn.lock?
I've tried the following:
% yarn why camelcase#7.0.0
yarn why v1.22.19
[1/4] π€ Why do we have the module "camelcase#7.0.0"...?
[2/4] π Initialising dependency graph...
[3/4] π Finding dependency...
error We couldn't find a match!
β¨ Done in 1.13s.
% yarn install
yarn install v1.22.19
[1/4] π Resolving packages...
[2/4] π Fetching packages...
error camelcase#7.0.0: The engine "node" is incompatible with this module. Expected version ">=14.16". Got "12.22.12"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
This question already has answers here:
Yarn global command not working
(13 answers)
Closed last year.
When I install expo it installs but it doesn't install. Here are the details about the issue.
I start off by typing:
yarn global add expo-cli#4
When it installs it says:
warning package.json: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents#1.2.13: The platform "linux" is incompatible with this module.
info "fsevents#1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents#2.3.2: The platform "linux" is incompatible with this module.
info "fsevents#2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "expo-cli > xdl > #expo/dev-server > #expo/metro-config > metro-react-native-babel-transformer#0.59.0" has unmet peer dependency "#babel/core#*".
[4/4] Building fresh packages...
When I install expo using yarn I get:
Installed "expo-cli#4.12.0" with binaries:
- expo
- expo-cli
Done in 4.30s.
But when I type 'expo --version' I get:
Command 'expo' not found, did you mean:
command 'exo' from snap exoscale-cli (v1.22.2)
command 'expn' from deb sendmail-base (8.15.2-18)
command 'expr' from deb coreutils (8.30-3ubuntu2)
See 'snap info <snapname>' for additional versions.
Based on what you posted I'm assuming that the folder where yarn installs global node modules isn't in your path.
Try one of these:
Try installing globally with npm (which is probably in your path)
npm i -g expo-cli
Add yarn global folder to path:
echo PATH="$PATH:$(yarn global bin)" >> ~/.bash_profile
See this thread for more info: Yarn global command not working
1: Go to the terminal and first input this
export PATH=$PATH:~/.npm-global/bin
2: After this command and enter this one
source ~/.bash_profile
How should I got about adding a warning message when a user tries to install a given version of a library?
For example, when you install babel-preset-es2015 you get the following warning:
π Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
By inspecting their code I saw they add a deprecated entry in their package.json as follows:
"deprecated": "π Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! ",
I can easily add that, but I'm not actually deprecating anything. I just want to warn users that they are installing an alpha version and there may be changes in the API.
Question
Is there a similar entry to deprecated that can do the job?
There's not necessarily a way you can do that, or not with given fields like "deprecated"
What you can do, which is a little bit of a workaround, is adding a post-install script, that outputs a string to the console if you mark a version as alpha.
// package.json
{
"version": "1.2.3-alpha.2",
"scripts": {
"postinstall": "node postinstall.js"
}
}
// postinstall.js
const package = require('./package.json')
if (package.version.includes('alpha')) {
console.log('You are using an alpha version. Beware!')
}
Please check out belows:
https://docs.npmjs.com/cli/deprecate
https://docs.npmjs.com/deprecating-and-undeprecating-packages-or-package-versions
$ npm deprecate <pkg>[#<version>] <message>
Example:
$ npm deprecate some-lib#"< 1.0.0" "π Thanks for using it. we recommend using new version, 1.x.x. Please check out https://example.com"
then,
$ yarn
yarn install v1.16.0
info No lockfile found.
[1/4] π Resolving packages...
warning some-lib#0.1.5: π Thanks for using it. we recommend using new version, 1.x.x. Please check out https://example.com
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
[4/4] π¨ Building fresh packages...
success Saved lockfile.
β¨ Done in 5.25s.
Time: 0h:00m:06s
On a project I have replaced npm with yarn to get the benefits of it, and also enforce our dependencies are locked in via the yarn.lock.
Now, a developer added a library with npm#4, which only changed the package.json, and not of course the yarn.lock.
I would have expected the yarn install command to crash on the build server, yet yarn has the--to me unexpected behavior--of adding those libraries in their most current version and then updating the yarn.lock on the remote:
$ yarn install
[1/4] Resolving packages...
[2/4] Fetching packages...
warning fsevents#1.1.2: The platform "linux" is incompatible with this module.
info "fsevents#1.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 5.07s.
This contradicts yarn's purpose, as the build job does not push the yarn.lock back to the repository nor should it.
I want each developer to be responsible of the version they are checking in.
Hence, is there a way to have yarn install exit with an error code if the package.json and yarn.lock are out of sync?
You want the --frozen-lockfile parameter:
$ yarn install --frozen-lockfile
yarn install v0.27.5
warning ../package.json: No license field
[1/4] Resolving packages...
error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`.
This was also recently made clear in the docs for yarn install:
yarn install
Install all the dependencies listed within package.json
in the local node_modules folder.
The yarn.lock file is utilized as follows:
If yarn.lock is present and is enough to satisfy all the dependencies
listed in package.json, the exact versions recorded in yarn.lock are
installed, and yarn.lock will be unchanged. Yarn will not check for
newer versions.
If yarn.lock is absent, or is not enough to satisfy
all the dependencies listed in package.json (for example, if you
manually add a dependency to package.json), Yarn looks for the newest
versions available that satisfy the constraints in package.json. The
results are written to yarn.lock.
If you want to ensure yarn.lock is not updated, use --frozen-lockfile.
I'm trying to generate a jHipster project using yarn - https://jhipster.github.io/installation/
I installed Node from its website and yarn with brew.
yarn version 0.19.1
node version v7.5.0
OSX Sierra 10.12.3
When I run yarn global add generator-jhipster, I could see jhispter generator being copied to /Users/{username}/.config/yarn/global/node_modules/
my-mac:~ user$ yarn global add generator-jhipster
yarn global v0.19.1
warning No license field
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
[4/4] π Building fresh packages...
warning undefined has no binaries
warning No license field
β¨ Done in 30.68s.
As the next step, when I run yo jhipster, it cannot find jhipster. However, when I run yarn add generator-jhipster, yo can find jhipster from current folder. Not sure whats wrong with adding in global location.
my-mac:~ user$ echo $PATH
/usr/local/sbin:~/.composer/vendor/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/Cellar/node/7.5.0/bin:/Users/{user}/.config/yarn/global/node_modules/.bin
Will appreciate any help in identify whats going on or if there is any issue with latest yarn version.
my-mac:~ user$ yo jhipster
Error jhipster
You donβt seem to have a generator with the name βjhipsterβ installed.
I had the same problem and the cause was my laziness. I did not took time to read the notes of Local installation with Yarn documentation:
Note: if you have problem to use these tools globally, be sure you have $HOME/.config/yarn/global/node_modules/.bin in your path.
On Mac or Linux: export PATH="$PATH:$(yarn global bin):$HOME/.config/yarn/global/node_modules/.bin"
To fix this issue I needed to install yeoman globally with yarn.
yarn global add yo
I am using Ubuntu and I faced this issue too. Then I use sudo to add yo package
sudo yarn global add yo
Hope this will helpful to you.