Yarn: Can't install package globally on Windows

Created on 12 Oct 2016  ยท  31Comments  ยท  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?
bug

What is the current behavior?
unable to install package globally

If the current behavior is a bug, please provide the steps to reproduce.

yarn global add pm2

c:\>yarn global add pm2
yarn global v0.15.1
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
error ENOENT: no such file or directory, open 'C:\Users\***\AppData\Local\Yarn\.global\node_modules\abbrev\abbrev.js'
    at Error (native)
info Visit http://yarnpkg.com/en/docs/cli/global for documentation about this command.

What is the expected behavior?
install package like npm install -g pm2

Please mention your node.js, yarn and operating system version.
Windows 10 x64 Enterprise, version 1607 (build 14393.321)
node js 6.7.0
yarn 0.15.1

cat-bug

Most helpful comment

I have probably found what is the issue. It appears that when yarn installs modules globally it puts executables to this location: C:\Users\User.Name\AppData\Local\Yarn\config\global\node_modules\.bin
And somehow when yarn was installed this location was not added to PATH (maybe because yarn was added using npm in my case). Adding mentioned folder to the PATH fixed the issue with missing executables issue for me.

All 31 comments

Hi

Same problem with Windows 7 Pro (x64)

Seems to be happening where there's a dependency on abbrev as this is also impacting installing yo

> yarn global add yo
yarn global v0.15.1
warning No license field
[1/4] Resolving packages...
warning yo > fullname > [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
[2/4] Fetching packages...
[3/4] Linking dependencies...
error ENOENT: no such file or directory, open 'C:\Users\gavinb\AppData\Local\Yarn\.global\node_modules\abbrev\abbrev.js'
    at Error (native)
info Visit http://yarnpkg.com/en/docs/cli/global for documentation about this command.
> node -v
v4.5.0

Windows 10 Build 14396

Edit:

I also tried manually installing abbrev:

> yarn global add abbrev
yarn global v0.15.1
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
warning [email protected] has no binaries
Done in 2.92s.

Looks like abbrev may be a package which builds it's native version on the machine when it's installed via npm.

Also in window10 (x64) , I can't globally install.

In linking dependencies.

This error:

[3/4] Linking dependencies...
โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘
โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘
error ENOENT: no such file or directory, open 'C:\Users\keypy\AppData\Local\Yarn\.global\node_modules\abbrev\abbrev.js'
    at Error (native)
# yarn -v
v0.15.1

# node -v
v4.5.0

Same here; Win10x64, node -v v6.7.0, yarn -v v0.15.1, chokes on .global\node_modules\abbrev\abbrev.js.

same here when installing karma global.

yarn global add are-we-there-yet
yarn global v0.15.1
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
warning [email protected]: The engine "rhino" appears to be invalid.
[3/4] Linking dependencies...
error ENOENT: no such file or directory, open 'C:\Users\myUsername\AppData\Local\Yarn.globalnode_modules\abbrev\abbrev.js'
at Error (native)
info Visit http://yarnpkg.com/en/docs/cli/global for documentation about this command.

windows 8.1 enterprise x64
node 4.5.0
npm 2.15.9

source: [https://github.com/yarnpkg/yarn/issues/1073#issuecomment-254158785]

It resolve by modifying the registry:
old value: https://registry.yarnpkg.com
new value (fixed): https://registry.yarnpkg.com//

add the double backlashes in registry. (yarn config set registry https://registry.yarnpkg.com//)

@altyne that didn't work got a error 500 on packages and install failed

I can also confirm this issue.

Node 6.9.1
Yarn 0.16.1
Windows Server 2012 R2 (x64)

1600 might be related

Can you reproduce this with yarn@latest? I'm not able to recreate the issue using the latest Yarn v0.17.10.

yarn global add pm2
yarn global v0.17.10
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[-/3] โข€ waiting...
[2/3] โ   fsevents: gyp info using [email protected] | win32 | x64
[-/3] โ   waiting...
[-/3] โ   waiting...
error Error running install script for optional dependency: <fsevents truncated>
success Installed [email protected] with binaries:
      - pm2
      - rundev
      - pm2-dev
      - pm2-docker
warning No license field
Done in 92.80s.

Still unable to install global packages with 0.17.10

[4/4] Building fresh packages...
success Installed [email protected] with binaries:
      - gulp
warning No license field
error An unexpected error occurred: "EPERM: operation not permitted, open 'C:\\Program Files\\nodejs\\gulp.cmd'".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\brian\\AppData\\Local\\Yarn\\config\\global\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
[4/4] Building fresh packages...
success Installed [email protected] with binaries:
      - bower
warning No license field
error An unexpected error occurred: "EPERM: operation not permitted, open 'C:\\Program Files\\nodejs\\bower.cmd'".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\brian\\AppData\\Local\\Yarn\\config\\global\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

@xt0rted that's a different error, as you're attempting to install into Program Files which requires admin access. You can run cmd as admin or change the prefix for yarn. Something like yarn config set prefix %AppData%\yarn.

Hi, I've installed yarn@latest. pm2 was installed along with several errors and I can't use pm2 command at all.

I've upgraded node js to 7.2.0 though, not sure if it's related.

c:\>yarn --version
0.17.10
c:\>yarn global add pm2
yarn global v0.17.10
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/1] โข€ fsevents: C:\Users\**username**\AppData\Local\Yarn\config\global\node_modules\fsevents>if not defined npm_config_node_gyp (node "C:\Users\**username**\AppData\Roaming\npm\node_modules\yarn\bin\node-gyp-bin\\..\..\node_modules\node-gyp
[-/1] โข€ waiting...
[-/1] โข€ waiting...
[-/1] โข€ waiting...
error Error running install script for optional dependency: "C:\\Users\\**username**\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents: Command failed.\nExit code: 1\nCommand: C:\\WINDOWS\\system32\\cmd.exe\nArguments: /d /s /c node-pre-gyp install --fallback-to-build\nDirectory: C:\\Users\\**username**\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\nOutput:\nnode-pre-gyp info it worked if it ends with ok\nnode-pre-gyp info using [email protected]\nnode-pre-gyp info using [email protected] | win32 | x64\nnode-pre-gyp info check checked for \"C:\\Users\\**username**\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\\lib\\binding\\Release\\node-v51-win32-x64\\fse.node\" (not found)\nnode-pre-gyp http GET https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v51-win32-x64.tar.gz\nnode-pre-gyp http 404 https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v51-win32-x64.tar.gz\nnode-pre-gyp ERR! Tried to download: https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v51-win32-x64.tar.gz \nnode-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v51 ABI) (falling back to source compile with node-gyp) \nnode-pre-gyp http Pre-built binary not available for your system, looked for https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v51-win32-x64.tar.gz \n\r\nC:\\Users\\**username**\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents>if not defined npm_config_node_gyp (node \"C:\\Users\\**username**\\AppData\\Roaming\\npm\\node_modules\\yarn\\bin\\node-gyp-bin\\\\..\\..\\node_modules\\node-gyp\\bin\\node-gyp.js\" clean )  else (node  clean ) \r\ngyp info it worked if it ends with ok\ngyp info using [email protected]\ngyp info using [email protected] | win32 | x64\ngyp info ok \n\r\nC:\\Users\\**username**\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents>if not defined npm_config_node_gyp (node \"C:\\Users\\**username**\\AppData\\Roaming\\npm\\node_modules\\yarn\\bin\\node-gyp-bin\\\\..\\..\\node_modules\\node-gyp\\bin\\node-gyp.js\" configure --fallback-to-build --module=C:\\Users\\**username**\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\\lib\\binding\\Release\\node-v51-win32-x64\\fse.node --module_name=fse --module_path=C:\\Users\\**username**\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\\lib\\binding\\Release\\node-v51-win32-x64 )  else (node  configure --fallback-to-build --module=C:\\Users\\**username**\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\\lib\\binding\\Release\\node-v51-win32-x64\\fse.node --module_name=fse --module_path=C:\\Users\\**username**\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\\lib\\binding\\Release\\node-v51-win32-x64 ) \r\ngyp info it worked if it ends with ok\ngyp info using [email protected]\ngyp info using [email protected] | win32 | x64\ngyp info spawn C:\\Python27\\python.exe\ngyp info spawn args [ 'C:\\\\Users\\\\**username**\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\yarn\\\\node_modules\\\\node-gyp\\\\gyp\\\\gyp_main.py',\ngyp info spawn args   'binding.gyp',\ngyp info spawn args   '-f',\ngyp info spawn args   'msvs',\ngyp info spawn args   '-G',\ngyp info spawn args   'msvs_version=auto',\ngyp info spawn args   '-I',\ngyp info spawn args   'C:\\\\Users\\\\**username**\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\fsevents\\\\build\\\\config.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   'C:\\\\Users\\\\**username**\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\yarn\\\\node_modules\\\\node-gyp\\\\addon.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   'C:\\\\Users\\\\**username**\\\\.node-gyp\\\\7.2.0\\\\include\\\\node\\\\common.gypi',\ngyp info spawn args   '-Dlibrary=shared_library',\ngyp info spawn args   '-Dvisibility=default',\ngyp info spawn args   '-Dnode_root_dir=C:\\\\Users\\\\**username**\\\\.node-gyp\\\\7.2.0',\ngyp info spawn args   '-Dnode_gyp_dir=C:\\\\Users\\\\**username**\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\yarn\\\\node_modules\\\\node-gyp',\ngyp info spawn args   '-Dnode_lib_file=node.lib',\ngyp info spawn args   '-Dmodule_root_dir=C:\\\\Users\\\\**username**\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\fsevents',\ngyp info spawn args   '--depth=.',\ngyp info spawn args   '--no-parallel',\ngyp info spawn args   '--generator-output',\ngyp info spawn args   'C:\\\\Users\\\\**username**\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\fsevents\\\\build',\ngyp info spawn args   '-Goutput_dir=.' ]\nTraceback (most recent call last):\r\n  File \"C:\\Users\\**username**\\AppData\\Roaming\\npm\\node_modules\\yarn\\node_modules\\node-gyp\\gyp\\gyp_main.py\", line 16, in <module>\r\n    sys.exit(gyp.script_main())\r\n  File \"C:\\Users\\**username**\\AppData\\Roaming\\npm\\node_modules\\yarn\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\__init__.py\", line 545, in script_main\r\n    return main(sys.argv[1:])\r\n  File \"C:\\Users\\**username**\\AppData\\Roaming\\npm\\node_modules\\yarn\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\__init__.py\", line 538, in main\r\n    return gyp_main(args)\r\n  File \"C:\\Users\\**username**\\AppData\\Roaming\\npm\\node_modules\\yarn\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\__init__.py\", line 523, in gyp_main\r\n    generator.GenerateOutput(flat_list, targets, data, params)\r\n  File \"C:\\Users\\**username**\\AppData\\Roaming\\npm\\node_modules\\yarn\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\generator\\msvs.py\", line 2003, in GenerateOutput\r\n    sln_projects, project_objects, flat=msvs_version.FlatSolution())\r\n  File \"C:\\Users\\**username**\\AppData\\Roaming\\npm\\node_modules\\yarn\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\generator\\msvs.py\", line 1762, in _GatherSolutionFolders\r\n    return _DictsToFolders('', root, flat)\r\n  File \"C:\\Users\\**username**\\AppData\\Roaming\\npm\\node_modules\\yarn\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\generator\\msvs.py\", line 1715, in _DictsToFolders\r\n    for folder, contents in bucket.iteritems():\r\nAttributeError: 'MSVSProject' object has no attribute 'iteritems'\r\ngyp ERR! configure error \ngyp ERR! stack Error: `gyp` failed with exit code: 1\ngyp ERR! stack     at ChildProcess.onCpExit (C:\\Users\\**username**\\AppData\\Roaming\\npm\\node_modules\\yarn\\node_modules\\node-gyp\\lib\\configure.js:305:16)\ngyp ERR! stack     at emitTwo (events.js:106:13)\ngyp ERR! stack     at ChildProcess.emit (events.js:191:7)\ngyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)\ngyp ERR! System Windows_NT 10.0.14393\ngyp ERR! command \"C:\\\\Program Files\\\\nodejs\\\\node.exe\" \"C:\\\\Users\\\\**username**\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\yarn\\\\node_modules\\\\node-gyp\\\\bin\\\\node-gyp.js\" \"configure\" \"--fallback-to-build\" \"--module=C:\\\\Users\\\\**username**\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\fsevents\\\\lib\\\\binding\\\\Release\\\\node-v51-win32-x64\\\\fse.node\" \"--module_name=fse\" \"--module_path=C:\\\\Users\\\\**username**\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\fsevents\\\\lib\\\\binding\\\\Release\\\\node-v51-win32-x64\"\ngyp ERR! cwd C:\\Users\\**username**\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\ngyp ERR! node -v v7.2.0\ngyp ERR! node-gyp -v v3.4.0\ngyp ERR! not ok \nnode-pre-gyp ERR! build error \nnode-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=C:\\Users\\**username**\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\\lib\\binding\\Release\\node-v51-win32-x64\\fse.node --module_name=fse --module_path=C:\\Users\\**username**\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\\lib\\binding\\Release\\node-v51-win32-x64' (1)\nnode-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\\Users\\**username**\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\\node_modules\\node-pre-gyp\\lib\\util\\compile.js:83:29)\nnode-pre-gyp ERR! stack     at emitTwo (events.js:106:13)\nnode-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)\nnode-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:885:16)\nnode-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)\nnode-pre-gyp ERR! System Windows_NT 10.0.14393\nnode-pre-gyp ERR! command \"C:\\\\Program Files\\\\nodejs\\\\node.exe\" \"C:\\\\Users\\\\**username**\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\fsevents\\\\node_modules\\\\node-pre-gyp\\\\bin\\\\node-pre-gyp\" \"install\" \"--fallback-to-build\"\nnsuccess Installed [email protected] with binaries:
      - pm2
      - rundev
      - pm2-dev
      - pm2-docker
warning No license field
Done in 6.51s.

try to use pm2:

c:\>pm2 list
'pm2' is not recognized as an internal or external command

I get the same error as @wtchangdm

ฮป yarn --version
0.17.10
ฮป yarn global add pm2
yarn global v0.17.10
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[-/4] โ ˆ waiting...
[-/4] โ  waiting...
[3/4] โ  fsevents: Failed to execute 'C:\Apps\nodejs\node.exe C:\Users\User.Name\AppData\Local\Yarn\
[-/4] โ  waiting...
error Error running install script for optional dependency: "C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents: Command failed.\nExit code: 1\nCommand: C:\\Windows\\system32\\cmd.exe\nArguments: /d /s /c node-pre-gyp install --fallback-to-build\nDirectory: C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\nOutput:\nnode-pre-gyp info it worked if it ends with ok\nnode-pre-gyp info using [email protected]\nnode-pre-gyp info using [email protected] | win32 | x64\nnode-pre-gyp info check checked for \"C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\\lib\\binding\\Release\\node-v51-win32-x64\\fse.node\" (not found)\nnode-pre-gyp http GET https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.15/fse-v1.0.15-node-v51-win32-x64.tar.gz\nnode-pre-gyp http 404 https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.15/fse-v1.0.15-node-v51-win32-x64.tar.gz\nnode-pre-gyp ERR! Tried to download: https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.15/fse-v1.0.15-node-v51-win32-x64.tar.gz \nnode-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v51 ABI) (falling back to source compile with node-gyp) \nnode-pre-gyp http Pre-built binary not available for your system, looked for https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.15/fse-v1.0.15-node-v51-win32-x64.tar.gz \ngyp info it worked if it ends with ok\ngyp info using [email protected]\ngyp info using [email protected] | win32 | x64\ngyp info ok \ngyp info it worked if it ends with ok\ngyp info using [email protected]\ngyp info using [email protected] | win32 | x64\ngyp info spawn C:\\Python27\\python.exe\ngyp info spawn args [ 'C:\\\\Users\\\\User.Name\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\node-gyp\\\\gyp\\\\gyp_main.py',\ngyp info spawn args   'binding.gyp',\ngyp info spawn args   '-f',\ngyp info spawn args   'msvs',\ngyp info spawn args   '-G',\ngyp info spawn args   'msvs_version=2015',\ngyp info spawn args   '-I',\ngyp info spawn args   'C:\\\\Users\\\\User.Name\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\fsevents\\\\build\\\\config.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   'C:\\\\Users\\\\User.Name\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\node-gyp\\\\addon.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   'C:\\\\Users\\\\User.Name\\\\.node-gyp\\\\7.2.0\\\\include\\\\node\\\\common.gypi',\ngyp info spawn args   '-Dlibrary=shared_library',\ngyp info spawn args   '-Dvisibility=default',\ngyp info spawn args   '-Dnode_root_dir=C:\\\\Users\\\\User.Name\\\\.node-gyp\\\\7.2.0',\ngyp info spawn args   '-Dnode_gyp_dir=C:\\\\Users\\\\User.Name\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\node-gyp',\ngyp info spawn args   '-Dnode_lib_file=node.lib',\ngyp info spawn args   '-Dmodule_root_dir=C:\\\\Users\\\\User.Name\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\fsevents',\ngyp info spawn args   '--depth=.',\ngyp info spawn args   '--no-parallel',\ngyp info spawn args   '--generator-output',\ngyp info spawn args   'C:\\\\Users\\\\User.Name\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\fsevents\\\\build',\ngyp info spawn args   '-Goutput_dir=.' ]\nTraceback (most recent call last):\r\n  File \"C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\node-gyp\\gyp\\gyp_main.py\", line 16, in <module>\r\n    sys.exit(gyp.script_main())\r\n  File \"C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\__init__.py\", line 545, in script_main\r\n    return main(sys.argv[1:])\r\n  File \"C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\__init__.py\", line 538, in main\r\n    return gyp_main(args)\r\n  File \"C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\__init__.py\", line 523, in gyp_main\r\n    generator.GenerateOutput(flat_list, targets, data, params)\r\n  File \"C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\generator\\msvs.py\", line 2003, in GenerateOutput\r\n
  sln_projects, project_objects, flat=msvs_version.FlatSolution())\r\n  File \"C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\generator\\msvs.py\", line 1762, in _GatherSolutionFolders\r\n    return _DictsToFolders('', root, flat)\r\n  File \"C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\generator\\msvs.py\", line 1715, in _DictsToFolders\r\n    for folder, contents in bucket.iteritems():\r\nAttributeError: 'MSVSProject' object has no attribute 'iteritems'\r\ngyp ERR! configure error \ngyp ERR! stack Error: `gyp` failed with exit code: 1\ngyp ERR! stack     at ChildProcess.onCpExit (C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\node-gyp\\lib\\configure.js:305:16)\ngyp ERR! stack     at emitTwo (events.js:106:13)\ngyp ERR! stack
at ChildProcess.emit (events.js:191:7)\ngyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)\ngyp ERR! System Windows_NT 6.1.7601\ngyp ERR! command \"C:\\\\Apps\\\\nodejs\\\\node.exe\" \"C:\\\\Users\\\\User.Name\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\node-gyp\\\\bin\\\\node-gyp.js\" \"configure\" \"--fallback-to-build\" \"--module=C:\\\\Users\\\\User.Name\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\fsevents\\\\lib\\\\binding\\\\Release\\\\node-v51-win32-x64\\\\fse.node\" \"--module_name=fse\" \"--module_path=C:\\\\Users\\\\User.Name\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\fsevents\\\\lib\\\\binding\\\\Release\\\\node-v51-win32-x64\" \"--python=C:\\\\tools\\\\Python27\\\\python.exe\" \"--msvs_version=2015\"\ngyp ERR! cwd C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\ngyp ERR! node -v v7.2.0\ngyp ERR! node-gyp -v v3.4.0\ngyp ERR! not ok \nnode-pre-gyp ERR! build error \nnode-pre-gyp ERR! stack Error: Failed to execute 'C:\\Apps\\nodejs\\node.exe C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\node-gyp\\bin\\node-gyp.js configure --fallback-to-build --module=C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\\lib\\binding\\Release\\node-v51-win32-x64\\fse.node --module_name=fse --module_path=C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\\lib\\binding\\Release\\node-v51-win32-x64 --python=C:\\tools\\Python27\\python.exe --msvs_version=2015' (1)\nnode-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\\node_modules\\node-pre-gyp\\lib\\util\\compile.js:83:29)\nnode-pre-gyp ERR! stack     at emitTwo (events.js:106:13)\nnode-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)\nnode-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:885:16)\nnode-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)\nnode-pre-gyp ERR! System Windows_NT 6.1.7601\nnode-pre-gyp ERR! command \"C:\\\\Apps\\\\nodejs\\\\node.exe\" \"C:\\\\Users\\\\User.Name\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\fsevents\\\\node_modules\\\\node-pre-gyp\\\\bin\\\\node-pre-gyp\" \"install\" \"--fallback-to-build\"\nnode-pre-gyp ERR! cwd C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\nnode-pre-gyp ERR! node -v v7.2.0\nnode-pre-gyp ERR! node-pre-gyp -v v0.6.29\nnode-pre-gyp ERR! not ok \nFailed to execute 'C:\\Apps\\nodejs\\node.exe C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\node-gyp\\bin\\node-gyp.js configure --fallback-to-build --module=C:\\Users\\User.Name\\AppData\\Local\\Yarn\\config\\global\\node_modules\\fsevents\\lib\\binding\\Release\\node-v51-win32-x64\\fse.node --msuccess Installed [email protected] with binaries:
      - pm2
      - rundev
      - pm2-dev
      - pm2-docker
warning No license field
Done in 26.08s.

I have Windows 7 x64 / Node 7.2.0

Errors from @zaggy and @wtchangdm seem to be from node-gyp. Last Two Stack Traces might not be a Yarn Error Do The packages Work Ehrn Installed With Npm?

Ps: Sorry About The Weird Capitalization. Something Is Not Working Well With Swiftkey And This Comment BOx On Github

I have probably found what is the issue. It appears that when yarn installs modules globally it puts executables to this location: C:\Users\User.Name\AppData\Local\Yarn\config\global\node_modules\.bin
And somehow when yarn was installed this location was not added to PATH (maybe because yarn was added using npm in my case). Adding mentioned folder to the PATH fixed the issue with missing executables issue for me.

The above fix by @zaggy worked for me too.

What I noticed with the PATH on my laptop was that it contained C:\Users\User.Name\AppData\Local\Yarn\.bin, which in my case at least is a directory that doesn't exist and isn't created when adding new packages.

I should also note that I installed Yarn using the .msi file, so it's not just installing it via npm that causes this.

@zaggy, if the installation command is run as administrator, it would be found that *.cmd files are put together with node.exe in c:\Program Files\nodejsใ€‚#1407

@yanxyz Same thing happens with gulp-cli , if installed w/ admin rights , any gulp command crashes the terminal in my case

@skhamoud Can confirm same issue. When yarn is installed from the msi installer and global packages are added from admin terminal, the resulting .cmd in C:Program Filesnodejs for any package crashes the terminal.

The crashing of the terminal is fixed in the pre-release 0.19.0

yeah, it tries to install into C:\Program Files\nodejs for me as well by default

This should be fixed in 0.24.x

If you install Yarn via npm, you'll need to manually add
%LocalAppData%\Yarnbin to your path.

Sent from my phone.

On May 27, 2017 4:13 AM, "W.T. Chang" notifications@github.com wrote:

Hi, I just installed 0.24.5 by npm. It can install global package now but
still not executable.

C:>yarn --version
0.24.5

C:>yarn global add pm2
yarn global v0.24.5
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed
compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘
โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘[4/4] Building fresh
packages...
success Installed "[email protected]" with binaries:
- pm2
- rundev
- pm2-dev
- pm2-docker
warning No license field
Done in 1.57s.

C:>pm2 -v
'pm2' is not recognized as an internal or external command, operable
program or batch file.

C:>

โ€”
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/yarnpkg/yarn/issues/859#issuecomment-304352555, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAFnHSnpT3euiIcOkPGn4PgRffHF4Svzks5r9xYygaJpZM4KUo_K
.

Using Yarn installed via .msi installer (version 0.24.6), then ran yarn add global polymer-cli it installs fine but get error when trying to use polymer-cli.
image

Installing npm modules globally din't work for me.
I tried installing them in project folder and they worked fine.
config:
windows 10
node.js 4.5.0
npm 2.15.9
run cmd as an administrator and look if the versions are latest and look for errors while running the command

In my case, my path variable was set at %LocalAppData%\Yarn\.bin, when the actual folder was %LocalAppData%\Yarn\bin (without the . in front of bin).

After removing the . everything worked fine again.

@lewisl9029 - Which version of Yarn do you have? That should have been fixed in the installer for 0.24.0: https://github.com/yarnpkg/yarn/commit/5fc8539bcd68266fd50802bacc295990444ea664

@Daniel15 That makes sense. I installed Yarn quite a while ago so I wouldn't be surprised if I used an installer version prior to 0.24.0. Glad to know it should no longer be a problem for new users!

I have this issue on Linux. I've installed polymer-cli globally, but polymer isn't in the path.

~ yarn global add polymer-cli
yarn global v1.3.2
[1/4] Resolving packages...
warning polymer-cli > [email protected]: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
warning polymer-cli > [email protected]: ๐Ÿ™Œ  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! 
warning polymer-cli > polyserve > @types/[email protected]: See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12826
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - polymer
Done in 25.08s.
โžœ  19:17 polymer
zsh: command not found: polymer
โžœ  19:17 polymer-cli init
zsh: command not found: polymer-cli
โžœ  19:17 yarn --version
1.3.2

@dandv - This issue is specific to Windows, as it was an issue with the MSI installer. Any Linux issues are unrelated. Please file a separate one.

Was this page helpful?
0 / 5 - 0 ratings