Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yarn command doesn't work on Windows 10: Here's a fix. #21

Open
twwilliams opened this issue Nov 2, 2017 · 9 comments
Open

yarn command doesn't work on Windows 10: Here's a fix. #21

twwilliams opened this issue Nov 2, 2017 · 9 comments
Labels

Comments

@twwilliams
Copy link

Yarn fails with an MSBuild error: MSB4132. It is looking for v2.0 of the build tools but only v4.0 is found.

To solve this problem, you need to do a couple of things:

  1. Install node's windows-build-tools: npm install -g windows-build-tools. You will need to do this from an elevated prompt. Some Microsoft documentation on the issue says to do it from an elevated PowerShell prompt. This will take a while, so be patient.
  2. Once finished, close your non-elevated terminal (if you have it open already) and re-open it.
  3. From your normal user terminal (doesn't need to be admin), set the msvs_version config setting with yarn config set msvs_version 2015. The npm command above sets it for npm but yarn needs it as well.

Once I did these things, I was able to complete the yarn command, run npm start successfully, and then see the Frontend Grocer site at http://localhost:3000/

@mike-north
Copy link
Member

Nice catch! My windows 10 must have had all of this stuff already installed. I'll think about how to integrate this with the CLI so developers don't have to spend time tracking this down.

@PhilipJohnBasile
Copy link

PhilipJohnBasile commented Mar 31, 2018

I did the above and am still having issues, unfortunately.

Phili@DESKTOP-5UPUI0N MINGW64 /d/GitHub/vscode-fundamentals (master)
$ yarn
yarn install v1.5.1
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info [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.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
[-/3] ⠄ waiting...
[-/3] ⠄ waiting...
[3/3] ⠄ node-sass: verb check python checking for Python executable "python" in the PATH
[-/3] ⠄ waiting...
error An unexpected error occurred: "D:\GitHub\vscode-fundamentals
ode_modules
ode-sass: Command failed.
Exit code: 1
Command: C:\WINDOWS\system32\cmd.exe
Arguments: /d /s /c node scripts/build.js
Directory: D:\GitHub\vscode-fundamentals
ode_modules
ode-sass
Output:
Building: C:\Program Files
odejs
ode.exe D:\GitHub\vscode-fundamentals
ode_modules
ode-gyp\bin
ode-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\
odejs\
ode.exe',
gyp verb cli 'D:\\GitHub\\vscode-fundamentals\
ode_modules\
ode-gyp\\bin\
ode-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb which failed Error: not found: python2
gyp verb which failed at getNotFoundError (D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:13:12)
gyp verb which failed at F (D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:68:19)
gyp verb which failed at E (D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:80:29)
gyp verb which failed at D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:89:16
gyp verb which failed at D:\GitHub\vscode-fundamentals
ode_modules\isexe\index.js:42:5
gyp verb which failed at D:\GitHub\vscode-fundamentals
ode_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:170:21)
gyp verb which failed python2 { Error: not found: python2
gyp verb which failed at getNotFoundError (D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:13:12)
gyp verb which failed at F (D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:68:19)
gyp verb which failed at E (D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:80:29)
gyp verb which failed at D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:89:16
gyp verb which failed at D:\GitHub\vscode-fundamentals
ode_modules\isexe\index.js:42:5
gyp verb which failed at D:\GitHub\vscode-fundamentals
ode_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:170:21)
gyp verb which failed stack: 'Error: not found: python2
at getNotFoundError (D:\\GitHub\\vscode-fundamentals\
ode_modules\\which\\which.js:13:12)
at F (D:\\GitHub\\vscode-fundamentals\
ode_modules\\which\\which.js:68:19)
at E (D:\\GitHub\\vscode-fundamentals\
ode_modules\\which\\which.js:80:29)
at D:\\GitHub\\vscode-fundamentals\
ode_modules\\which\\which.js:89:16
at D:\\GitHub\\vscode-fundamentals\
ode_modules\\isexe\\index.js:42:5
at D:\\GitHub\\vscode-fundamentals\
ode_modules\\isexe\\windows.js:36:5
at FSReqWrap.oncomplete (fs.js:170:21)',
gyp verb which failed code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb which failed Error: not found: python
gyp verb which failed at getNotFoundError (D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:13:12)
gyp verb which failed at F (D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:68:19)
gyp verb which failed at E (D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:80:29)
gyp verb which failed at D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:89:16
gyp verb which failed at D:\GitHub\vscode-fundamentals
ode_modules\isexe\index.js:42:5
gyp verb which failed at D:\GitHub\vscode-fundamentals
ode_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:170:21)
gyp verb which failed python { Error: not found: python
gyp verb which failed at getNotFoundError (D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:13:12)
gyp verb which failed at F (D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:68:19)
gyp verb which failed at E (D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:80:29)
gyp verb which failed at D:\GitHub\vscode-fundamentals
ode_modules\which\which.js:89:16
gyp verb which failed at D:\GitHub\vscode-fundamentals
ode_modules\isexe\index.js:42:5
gyp verb which failed at D:\GitHub\vscode-fundamentals
ode_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:170:21)
gyp verb which failed stack: 'Error: not found: python
at getNotFoundError (D:\\GitHub\\vscode-fundamentals\
ode_modules\\which\\which.js:13:12)
at F (D:\\GitHub\\vscode-fundamentals\
ode_modules\\which\\which.js:68:19)
at E (D:\\GitHub\\vscode-fundamentals\
ode_modules\\which\\which.js:80:29)
at D:\\GitHub\\vscode-fundamentals\
ode_modules\\which\\which.js:89:16
at D:\\GitHub\\vscode-fundamentals\
ode_modules\\isexe\\index.js:42:5
at D:\\GitHub\\vscode-fundamentals\
ode_modules\\isexe\\windows.js:36:5
at FSReqWrap.oncomplete (fs.js:170:21)',
gyp verb which failed code: 'ENOENT' }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (D:\GitHub\vscode-fundamentals
ode_modules
ode-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (D:\GitHub\vscode-fundamentals
ode_modules
ode-gyp\lib\configure.js:508:16)
gyp ERR! stack at D:\GitHub\vscode-fundamentals
ode_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:170:21)
gyp ERR! System Windows_NT 10.0.17133
gyp ERR! command "C:\\Program Files\
odejs\
ode.exe" "D:\\GitHub\\vscode-fundamentals\
ode_modules\
ode-gyp\\bin\
ode-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\GitHub\vscode-fundamentals
ode_modules
ode-sass
gyp ERR! node -v v9.10.1
gyp ERR! node-gyp -v v3.6.2

@PhilipJohnBasile
Copy link

This is what happens when I do NPM Install

Phili@DESKTOP-5UPUI0N MINGW64 /d/GitHub/vscode-fundamentals (master)
$ npm install
npm WARN rm not removing D:\GitHub\vscode-fundamentals\node_modules\sqlite3\node_modules.bin\node-pre-gyp.cmd as it wasn't installed by D:\GitHub\vscode-fundamentals\node_modules\sqlite3\node_modules\node-pre-gyp
npm WARN rm not removing D:\GitHub\vscode-fundamentals\node_modules\sqlite3\node_modules.bin\node-pre-gyp as it wasn't installed by D:\GitHub\vscode-fundamentals\node_modules\sqlite3\node_modules\node-pre-gyp
npm WARN rm not removing D:\GitHub\vscode-fundamentals\node_modules.bin\semver.cmd as it wasn't installed by D:\GitHub\vscode-fundamentals\node_modules\semver
npm WARN rm not removing D:\GitHub\vscode-fundamentals\node_modules.bin\semver as it wasn't installed by D:\GitHub\vscode-fundamentals\node_modules\semver
npm WARN rm not removing D:\GitHub\vscode-fundamentals\node_modules.bin\nopt.cmd as it wasn't installed by D:\GitHub\vscode-fundamentals\node_modules\nopt
npm WARN rm not removing D:\GitHub\vscode-fundamentals\node_modules.bin\nopt as it wasn't installed by D:\GitHub\vscode-fundamentals\node_modules\nopt

[email protected] install D:\GitHub\vscode-fundamentals\node_modules\node-sass
node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.3/win32-x64-59_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.5.3/win32-x64-59_binding.node":

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.

  export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

  npm config set proxy http://example.com:8080

[email protected] install D:\GitHub\vscode-fundamentals\node_modules\sqlite3
node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.9/node-v59-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v59 ABI) (falling back to source compile with node-gyp)
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
unpack_sqlite_dep
'python' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [D:\GitHub\vscode-fundamentals\node_modules\sqlite3\build\deps\action_before_build.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:180:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Windows_NT 10.0.17133
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=D:\GitHub\vscode-fundamentals\node_modules\sqlite3\lib\binding\node-v59-win32-x64\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=D:\GitHub\vscode-fundamentals\node_modules\sqlite3\lib\binding\node-v59-win32-x64"
gyp ERR! cwd D:\GitHub\vscode-fundamentals\node_modules\sqlite3
gyp ERR! node -v v9.10.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\GitHub\vscode-fundamentals\node_modules\sqlite3\lib\binding\node-v59-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\GitHub\vscode-fundamentals\node_modules\sqlite3\lib\binding\node-v59-win32-x64' (1)
node-pre-gyp ERR! stack at ChildProcess. (D:\GitHub\vscode-fundamentals\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:180:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:936:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
node-pre-gyp ERR! System Windows_NT 10.0.17133
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\GitHub\vscode-fundamentals\node_modules\sqlite3\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd D:\GitHub\vscode-fundamentals\node_modules\sqlite3
node-pre-gyp ERR! node -v v9.10.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\GitHub\vscode-fundamentals\node_modules\sqlite3\lib\binding\node-v59-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\GitHub\vscode-fundamentals\node_modules\sqlite3\lib\binding\node-v59-win32-x64' (1)
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, scandir 'D:\GitHub\vscode-fundamentals\node_modules\sqlite3\node_modules\node-pre-gyp\node_modules\request\node_modules\http-signature\node_modules'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, scandir 'D:\GitHub\vscode-fundamentals\node_modules\fsevents\node_modules'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Phili\AppData\Roaming\npm-cache_logs\2018-03-31T03_31_12_596Z-debug.log

Phili@DESKTOP-5UPUI0N MINGW64 /d/GitHub/vscode-fundamentals (master)
$

@PhilipJohnBasile
Copy link

Fixed it by installing python in windows

https://www.python.org/downloads/

Do the custom option and check everything. Then increase the path size at the end. Boom works!

@kraudmor
Copy link

kraudmor commented Aug 2, 2018

Little update to twwilliams comment on 3 Nov 2017 for Window 10 x64 users.
This steps helped me to avoid sqlite3 build:

  1. Remove sqlite3 dependency from package.json.
  2. Run yarn install.
  3. Run yarn add sqlite3.

Now you should be able to run npm start.
If you still having issues don't forget to try node-gyp installation instructions on Windows.

@ogrotten
Copy link

Fixed it by installing python in windows

https://www.python.org/downloads/

Do the custom option and check everything. Then increase the path size at the end. Boom works!

Which version did you install?

@yinjinit
Copy link

Works for me either. Big thumbs up.

@misirajudeen
Copy link

The below is the log from the PowerShell admin user execution.

PS C:\Users\4000> npm -v
6.14.6

PS C:\Users\4000> npm install -g windows-build-tools
npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
npm WARN deprecated [email protected]: this library is no longer supported

[email protected] postinstall C:\Users\4000\AppData\Roaming\npm\node_modules\windows-build-tools
node ./dist/index.js

C:\Users\4000\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\os.js:53
throw resultError;
^

Error: spawnSync powershell.exe ENOENT
at Object.spawnSync (internal/child_process.js:1041:20)
at Object.spawnSync (child_process.js:616:24)
at spawnSync (C:\Users\4000\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:67:36)
at Object.queryRegFromPowershell (C:\Users\4000\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:73:3)
at loop (C:\Users\4000\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:113:16)
at C:\Users\4000\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:116:7
at C:\Users\4000\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:100:5
at spawnSync (C:\Users\4000\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:68:2)
at Object.queryRegFromRegExe (C:\Users\4000\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:96:3)
at loop (C:\Users\4000\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:113:16) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawnSync powershell.exe',
path: 'powershell.exe',
spawnargs: [
'-NoProfile',
'-ExecutionPolicy',
'-Command',
'& {(Get-ItemProperty -Path "Registry::HKU\.DEFAULT\Control Panel\International\Geo" -Name Nation).Nation}'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: node ./dist/index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\4000\AppData\Roaming\npm-cache_logs\2020-10-06T11_14_52_261Z-debug.log

@EndiHariadi43
Copy link

Thank you very much. This is very helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants