I am using macOS Sierra 10.12.4 and I have installed yarn by brew install yarn and its version is yarn version v0.23.2
I installed angular-cli, bower and ionic using yarn global add <package-name>
Then I use yarn global ls to display globally installed packages and I am expecting to see the above installed packages but yarn gives me this:
$ yarn global ls
yarn global v0.23.2
warning No license field
✨ Done in 0.99s.
Then i check yarn global bin and get path /Users/myusername/.config/yarn/bin and I go to the directory and see softlinks:
lrwxr-xr-x 1 myusername staff 38B 19 Apr 10:17 bower -> ../global/node_modules/bower/bin/bower
lrwxr-xr-x 1 myusername staff 42B 19 Apr 10:21 cordova -> ../global/node_modules/cordova/bin/cordova
lrwxr-xr-x 1 myusername staff 38B 19 Apr 10:20 ionic -> ../global/node_modules/ionic/bin/ionic
lrwxr-xr-x 1 myusername staff 41B 19 Apr 10:15 ng -> ../global/node_modules/angular-cli/bin/ng
Apparently all packages were installed and saved under /Users/myusername/.config/yarn/global/node_modules
I searched the following threads
https://github.com/yarnpkg/yarn/issues/2446
Tried appending the below paths but still not work:
YARN_BIN=$HOME/.config/yarn/bin # `yarn global bin` result
export PATH=$YARN_BIN:$PATH
export PATH=$PATH:$HOME/.config/yarn/global/node_modules/.bin
Can anyone help? What should I do and how to display the globally installed packages?
yarn global list
The command had issue in Spring 2017, that had been fixed.
2017 workaround
Currently I directly list Yarn global packages folder content:
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
Update June 22, 2020
As of May 12, 2017 this problem has been resolved. See issue and pull request.
So you can use yarn global list to list all globally installed packages.
yarn global list has been fixed, see issue and pull request.
I have did some research for a couple of days but haven't get quite helpful solutions.
#2224 #3142 and some other Github issues relate to this.
This is how I get the global installed packages so far:
go to ~/.config/yarn/bin, it shows the packages but no version tags.
go to ~/.config/yarn/global and run cat package.json to display the installed packages
Content:
{
"dependencies": {
"angular-cli": "^1.0.0-beta.28.3",
"bower": "^1.8.0",
"yo": "^1.8.5",
"browser-sync": "^2.18.8",
"cordova": "^6.5.0",
"generator-jhipster": "^4.3.0",
"ionic": "^2.2.2",
"ts": "^0.0.0",
"typescript": "^2.2.2"
}
}
To check whether the info is accurate, I run yarn global remove yo, then yo is gone in the ~/.config/yarn/bin folder and then I cat package.json again and yo has removed from the file as well.
"dependencies": {
"angular-cli": "^1.0.0-beta.28.3",
"bower": "^1.8.0",
"browser-sync": "^2.18.8",
"cordova": "^6.5.0",
"generator-jhipster": "^4.3.0",
"ionic": "^2.2.2",
"ts": "^0.0.0",
"typescript": "^2.2.2"
}
}
npm works perfectly on my machine but yarn is much faster, that's why I don't want to go back to npm...
Hope someone can provide more elegant way to achieve this.
I found my solution here in windows 10:
C:\Users\{YOUR_USERNAME}\node_modules\.bin
just add this path to my environment variables
Related
I'm developing in Ubuntu 22.04 Desktop environment. To produce a packaged app for Windows do I need to use a MS Windows environment or can I do it within Ubuntu 22.04 Desktop environment? I ask this, because I do not see any "windows"-related output:
/out/make$ ls -lah
total 20K
drwxrwxr-x 5 raphy raphy 4,0K gen 5 12:42 .
drwxrwxr-x 4 raphy raphy 4,0K gen 5 12:41 ..
drwxrwxr-x 3 raphy raphy 4,0K gen 5 12:41 deb
drwxrwxr-x 3 raphy raphy 4,0K gen 5 12:42 rpm
drwxrwxr-x 3 raphy raphy 4,0K gen 5 12:42 zip
even if I've set in package.json maker-squirrel :
"makers": [
{
"name": "#electron-forge/maker-squirrel",
Do I have to install the wine terminal in my Ubuntu 22.04 Desktop environment, in order to correctly product the Windows packaged app? Or what else do I have to do?
Executing : yarn make --platform=win32 I get the following message:
raphy#raohy:~/ForgeTypescriptReactWebpack$ yarn make --platform=win32
yarn run v1.22.19
$ electron-forge make --platform=win32
✔ Checking your system
✔ Loading configuration
✔ Resolving make targets
› Making for the following targets: squirrel, zip
❯ Running package command
✔ Preparing to package application
✔ Running packaging hooks
✔ Running generateAssets hook
✔ Running prePackage hook
✔ [plugin-webpack] Preparing native dependencies: 1 / 1
✔ [plugin-webpack] Building webpack bundles
❯ Packaging application
❯ Packaging for x64 on win32
✔ Copying files
✔ Preparing native dependencies [0.1s]
✖ Finalizing package
› Wrapper command 'wine64' not found on the system. Consult your Linux distribution's package manager to deter…
Wine is required to use the appCopyright, appVersion, buildVersion, icon, and
win32metadata parameters for Windows targets.
See https://github.com/electron/electron-packager#building-windows-apps-from-non-windows-platforms for detai…
◼ Running postPackage hook
◼ Running preMake hook
◼ Making distributables
◼ Running postMake hook
An unhandled rejection has occurred inside Forge:
Error: Wrapper command 'wine64' not found on the system. Consult your Linux distribution's package manager to determine how to install Wine.
Wine is required to use the appCopyright, appVersion, buildVersion, icon, and
win32metadata parameters for Windows targets.
See https://github.com/electron/electron-packager#building-windows-apps-from-non-windows-platforms for details.
at spawnWrapper (/home/raphy/ForgeTypescriptReactWebpack/node_modules/cross-spawn-windows-exe/dist/src/wrapper.js:77:19)
at async module.exports (/home/raphy/ForgeTypescriptReactWebpack/node_modules/rcedit/lib/rcedit.js:42:3)
at async WindowsApp.runRcedit (/home/raphy/ForgeTypescriptReactWebpack/node_modules/electron-packager/src/win32.js:95:7)
at async WindowsApp.create (/home/raphy/ForgeTypescriptReactWebpack/node_modules/electron-packager/src/win32.js:105:5)
at async Promise.all (index 0)
at async packager (/home/raphy/ForgeTypescriptReactWebpack/node_modules/electron-packager/src/index.js:204:20)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
So, definitely Wine has to be installed
After installing wine and executing the yarn make --platform=win32 again, I get some strange errors, for which I open another post
I would like to keep all other package versions in tact, but upgrade one single package to the most recent version. How can I do that using yarn?
I know I can delete yarn.lock, and then run yarn install, but I think that will upgrade every package, which I don't want. I just want the most recent version of node-sass, and for that to override the version I have in yarn.lock.
How can this be done?
According to Yarn documentation:
yarn up [package]
yarn up [package]#[version]
yarn up [package]#[tag]
So, to upgrade node-sass, you should run:
yarn up node-sass
The answer by Rodrigo Merlone does not work with yarn-classic. For yarn-classic, a resolution is required.
{
"dependencies": {
"left-pad": "1.0.0",
"c": "file:../c-1",
"d2": "file:../d2-1"
},
"resolutions": {
"d2/left-pad": "1.1.1",
"c/**/left-pad": "^1.1.2"
}
}
More info:
https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/
Recently, due to a problem, I had reinstall all my libraries which included CoffeeScript also. My problem is that my team has one version of CoffeeScript while I have a newer one. So every time we push code there is conflict in javascript. Any pointers on how I can downgrade CoffeeScript version in MAC OS would be really helpful.
Operation System: OS X El Capitan installed.
If you used NPM, install the older version of CoffeeScript with the following command:
npm install -g coffee-script#1.11.1
Close and reopen your terminal.
Check if you have the correct version installed:
coffee -v
On a side note, it might be better to maintain your project dependencies with package.json. That way, your team will always be in sync with the relevant package versions.
{
"name": "coffee-app",
"version": "1.0.0",
"main": "index.coffee",
"scripts": {
"start": "./node_modules/.bin/coffee index.coffee"
},
"dependencies": {
"coffee-script": "^1.11.1"
}
}
Just run npm install to install project dependencies.
And run npm start to start app with the correct "coffee version" for your app.
I am creating an iOS app and use Carthage to build external libraries. Since the libraries I use are currently both Swift 2 and Swift 3 I am in a bit of a squeeze. Thus I want to have one Swift 2 branch and one Swift 3 branch for development and then merge them when the libraries are all Swift 3 compatible.
However, I am not able to select which toolchain for build for with Carthage (version 0.18).
Here is the contents of my Cartfile:
# Swift 2 libraries
github "stephencelis/SQLite.swift" ~> 0.10.1
github "Haneke/HanekeSwift"
# Swift 3 libraries
#github "stephencelis/SQLite.swift" "swift3"
#github "Haneke/HanekeSwift" "feature/swift-3"
#github "kitasuke/PagingMenuController"
#github "Alamofire/Alamofire" ~> 4.0
This currently builds by using carthage update. Here are some output verifying that I am currently using Swift 2:
$ swift --version
Apple Swift version 2.2 (swiftlang-703.0.18.8 clang-703.0.31)
Target: x86_64-apple-macosx10.9
$ ls -lh $(which swift)
-rwxr-xr-x 1 root wheel 18K Jul 8 19:52 /usr/bin/swift
Now I want to switch to build with Swift 3. I have multiple toolchains installed in /Library/Developer/Toolchains, which is where OSX installs them when I run the installer:
$ ls -lh /Library/Developer/Toolchains
drwxr-xr-x 6 root wheel 204B Sep 30 20:07 swift-2.2.1-SNAPSHOT-2016-04-23-a.xctoolchain
drwxr-xr-x 7 root wheel 238B Sep 30 17:41 swift-3.0-RELEASE.xctoolchain
drwxr-xr-x 7 root wheel 238B Oct 6 20:53 swift-3.0.1-PREVIEW-2.xctoolchain
lrwxr-xr-x 1 root wheel 30B Oct 8 12:51 swift-latest.xctoolchain -> swift-3.0-RELEASE.xctoolchain/
Note that I have both Xcode8 and Xcode7 installed:
$ ls /Applications/Xcode*
/Applications/Xcode.app:
Contents
/Applications/Xcode8.app:
Contents
$ xcodebuild -version
Xcode 7.3.1
Build version 7D1014
Now, lets say I have the following scenario:
$ cat Cartfile
github "Alamofire/Alamofire" ~> 4.0
$ carthage update --toolchain com.apple.dt.toolchain.Swift_3_0
*** Fetching Alamofire
*** Checking out Alamofire at "4.0.1"
*** xcodebuild output can be found in /var/folders/wg/fjk346qs7mx8fhplf8_805wm0000gn/T/carthage-xcodebuild.zfHVn5.log
*** Building scheme "Alamofire iOS" in Alamofire.xcworkspace
warning: failed to load toolchain 'com.apple.dt.toolchain.Swift_3_0': Could not find toolchain: com.apple.dt.toolchain.Swift_3_0
I just cannot get this to work. So my question is:
How can I build with Carthage by using another toolchain?
Here's what I have tried:
Changing the symbolic link of swift-latest.xctoolchain to other things. Does no difference.
Manually adding the toolchains to my PATH variable in .bashrc like this, but it makes no difference.
$ cat ~/.bashrc
export PATH="$PATH:/Library/Developer/Toolchains/swift-2.2.1-SNAPSHOT-2016-04-23-a.xctoolchain/usr/bin/"
export PATH="$PATH:/Library/Developer/Toolchains/swift-3.0-RELEASE.xctoolchain/usr/bin/"
export PATH="$PATH:/Library/Developer/Toolchains/swift-3.0.1-PREVIEW-2.xctoolchain/usr/bin/"
Running the build with TOOLCHAINS=com.apple.dt.toolchain.Swift_3_0 carthage build and similar, but it makes no difference (still cannot find the toolchain).
As of Carthage 0.17 there is an option --toolchain that allows one to specify an exact toolchain ID to use for the build. Example usage:
carthage update --toolchain org.swift.402017072a
The ID of the toolchain comes from the key CFBundleIdentifier in Info.plist file of the toolchain.
I solved this by using the command sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/ or similar, thereby setting the toolchain to the proper one. This will then be the default one used by Carthage. I could not figure out how to select another toolchain when running Carthage.
You can use
export TOOLCHAINS="org.swift.51220191107a"
export TOOLCHAIN_DIR=/Library/Developer/Toolchains/swift-5.1.2-RELEASE.xctoolchain
carthage update
Download Swift toolchain
https://swift.org/download/#releases
Just
export TOOLCHAINS="swift"
do the trick.
I have installed node and npm onto my computer without a problem (I am running windows 8) however this is my first time using windows and I cant seem to access any packages I install without getting an error message Could not find files for the given I should also mention im working in visual studios on a .net and angular project, the node is just for testing.
where node gives me C:\Program Files\nodejs\node.exe
where npm gives me C:\Program Files\nodejs\npm.cmd
but I know the karma package I installed went to C:\Users\Admin\AppData\Roaming\npm\node_modules I have added a NODE_PATH to my environment variables but it didnt help. Any thoughts?
this is a snippet from command prompt:
C:\Users\Admin\AppData\Roaming\npm\node_modules>dir
Volume in drive C is 000000
Volume Serial Number is 000000
Directory of C:\Users\Admin\AppData\Roaming\npm\node_modules
2015-01-05 06:39 PM <DIR> .
2015-01-05 06:39 PM <DIR> ..
2015-01-05 06:39 PM <DIR> karma
2015-01-05 06:39 PM <DIR> karma-cli
0 File(s) 0 bytes
4 Dir(s) 918,342,209,536 bytes free
C:\Users\Admin\AppData\Roaming\npm\node_modules>where karma
INFO: Could not find files for the given pattern(s).
C:\Users\Admin\AppData\Roaming\npm\node_modules>
Are you trying to use the command-line command karma or require() the package in a module? You need to install packages differently for these use cases.
> npm install -g karma
Will install the karma package globally, and it should then be accessible from your command line. You may need to close and re-open your command prompt or re-set the PATH environment var.
If you want to use the package with require, you will need to create a package directory, run npm init, and then install karma locally with npm install --save karma. This will install the package under the node_modules directory for that package only. npm does this to avoid conflicts between different packages which may require different versions of the same package.
Please forgive me if I am misunderstanding your question.