Closed djD-REK closed 4 years ago
I also tried
npm install --global --production rollup
and
npm install --global --production node-gyp
but it's no different than with nothing installed as far as I can tell. At least, I'm getting the same errors.
If I try to run node-gyp I get this message:
node-gyp : File C:\Users\Derek\AppData\Roaming\npm\node-gyp.ps1 cannot be loaded because running scripts is disabled
on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ node-gyp
+ ~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
That led me to try node-gyp in my usual terminal (Lambda), which worked fine.
But I still couldn't node-gyp configure, because I get this error with that command:
gyp: binding.gyp not found (cwd: C:\dev\screeps-typescript-starter) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Users\Derek\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:311:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Derek\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure"
gyp ERR! cwd C:\dev\screeps-typescript-starter
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok
But, I found this guide https://github.com/nodejs/node-gyp/issues/702#issuecomment-523612154
Which suggested I create a bindings.gyp file: { "targets": [ { "target_name": "binding", "sources": [ "build/Release/binding.node" ] } ] } Reference: https://github.com/nodejs/node-gyp#the-bindinggyp-file
which then let me run
node-gyp rebuild
which I think would have been equivalent to:
node-gyp configure
node-gyp build
That finally let me npm install, which looking at it more closely looks like it calls node-gyp --rebuild, but I'm pretty sure it did not work for me until I did the --rebuild.
So to recap, I think I needed npm global install of windows-build-tools, npm global install of node-gyp, then a bindings.gyp file somewhere (in whatever my current working directory is), then node-gyp rebuild, then npm install.
To duplicate my issue, I deleted the yarn.lock and package-lock.json files as well as the node-module files, then I uninstalled the packages:
npm uninstall --global windows-build-tools
npm uninstall --global rollup
npm uninstall --global node-gyp
npm uninstall --global socket-io
npm uninstall --global npm
These are various packages I had installed with testing, though socket-io should have been socket.io if I was paying more attention.
This left me with an empty npm global list, double-checking installs with
npm list --global
So I repeated the same thing with yarn:
yarn global remove node-gyp
yarn global list
I even went and searched Windows (Win+R for Run) for Uninstall Python, clicked that, and removed Python 2.7 -- I had previously removed Python 3.8 from the Windows Store.
I furthermore searched Windows (Win+R for Run) for Visual Studio Installer, clicked that, clicked More, under Installed -> Visual Studio Build Tools 2017, clicked Uninstall, clicked OK.
I waited a long time
I should be really starting fresh, to document the fix steps for a new user.
I start reproducing my steps here
Then I tried to install them fresh, using my regular terminal (lambda, with git for Windows installed, and my current version of node) as much as I could.
I then ran these npm commands:
Step 1: From an Administrative Powershell (Windows key + X, Windows Powershell Admin):
npm install --global --production windows-build-tools --vs2017
Resulting in success:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Windows\system32> npm install --global --production windows-build-tools --vs2017
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
> windows-build-tools@5.2.2 postinstall C:\Users\Derek\AppData\Roaming\npm\node_modules\windows-build-tools
> node ./dist/index.js
Downloading python-2.7.15.amd64.msi
[> ] 0.0% (0 B/s)
Downloaded python-2.7.15.amd64.msi. Saved to C:\Users\Derek\.windows-build-tools\python-2.7.15.amd64.msi.
Downloading vs_BuildTools.exe
[> ] 0.0% (0 B/s)
Downloaded vs_BuildTools.exe. Saved to C:\Users\Derek\.windows-build-tools\vs_BuildTools.exe.
Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!
Status from the installers:
---------- Visual Studio Build Tools ----------
Successfully installed Visual Studio Build Tools.
------------------- Python --------------------
Still waiting for installer log file...
Now configuring the Visual Studio Build Tools and Python...
All done!
+ windows-build-tools@5.2.2
added 144 packages from 98 contributors in 34.47s
PS C:\Windows\system32>
Steps 2-4: Then from my regular terminal (Lambda with Git for Windows) -- because I knew Administrative Powershell would balk at me running node-gyp, as that is written in Python, and I would have to change the scripts access restriction to run from that terminal.
I navigated navigated my terminal to =open the /screeps-typescript-starter/ directory, then I made the bindings.gyp file in that current directory, using the sample text from above.
Then I ran these npm commands:
npm install --global node-gyp
node-gyp rebuild
npm install
But it didn't quite work, as I will explain below:
Note that node-gyp rebuild by itself did not work, I got this error:
node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@12.16.1 | win32 | x64
gyp info find Python using Python version 2.7.15 found at "C:\Users\Derek\.windows-build-tools\python27\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking VS2017 (15.9.28307.1093) found at:
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
gyp ERR! find VS - found "Visual Studio C++ core features"
gyp ERR! find VS - found VC++ toolset: v141
gyp ERR! find VS - missing any Windows SDK
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (C:\Users\Derek\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack at C:\Users\Derek\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\Derek\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack at C:\Users\Derek\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack at C:\Users\Derek\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack at C:\Users\Derek\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at C:\Users\Derek\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:310:5)
gyp ERR! stack at ChildProcess.emit (events.js:311:20)
gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Derek\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\dev\screeps-typescript-starter
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok
I tried updating the binding.gyp file to reference an existing file (binding.sln) I found in the repository:
{
"targets": [
{
"target_name": "binding",
"sources": [ "build/binding.sln" ]
}
]
}
That let me run
node-gyp build
and then if I changed binding.gyp back to the other way it seemed to work fine:
{
"targets": [
{
"target_name": "binding",
"sources": [ "build/Release/binding.node" ]
}
]
}
Now I could run
node-gyp build
Albeit with this error message:
Warning: Missing input files:
C:\dev\screeps-typescript-starter\build\..\build\Release\binding.node
But I changed it back to the first way just to be consistent, with the binding.sln file.
Steps 1-4: So, to recap, all 4 commands together -- and only the first command has to be run in Administrative Windows PowerShell, the rest should be run in the usual terminal:
npm install --global --production windows-build-tools --vs2017
npm install --global node-gyp
node-gyp rebuild
npm install
A quick note regarding the previous question I posed about needing "node-gyp configure" and "node-gyp build" -- "npm node-gyp rebuild" did seem to work the same as build and configure, based on it ending with the message "ok" at least. This makes sense based on the console documentation message for node-gyp that lists rebuild - Runs "clean", "configure" and "build" all at once
😃
But npm install still did not work ^ So I don't know how I fixed it the first time
I deleted the lock files and global installs for npm again and then tried it with yarn:
The yarn instructions are similar but would use yarn terminology. From an Administrative Powershell (Windows key + X, Windows Powershell Admin):
yarn global add windows-build-tools --vs2017
Then from a regular terminal: (Lambda with Git for Windows):
yarn global add node-gyp
node-gyp rebuild
yarn install
Still no dice -- it didn't work.
I tried this solution: https://github.com/nodejs/node-gyp/issues/702#issuecomment-468214903
My solution on Windows 10.
Only these solution helps.
You need file visualcppbuildtools_full.exe !!
Go here https://visualstudio.microsoft.com/ru/visual-cpp-build-tools/
My link: https://download.microsoft.com/download/5/f/7/5f7acaeb-8363-451f-9425-68a90f98b238/visualcppbuildtools_full.exe
You require file: visualcppbuildtools_full.exe.
Install all versions for windows 8.1 and 10 (~6-8Gb).
Its create folder C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140...
And be happy :-)
But it still didn't work.
So, somehow, I got it working there briefly, but I was unable to reproduce my fix when I tried to duplicate the issue.
Other random things I tried:
npm install --global node-gyp@latest
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
I found this note:
https://github.com/nodejs/node-gyp/issues/2025#issuecomment-606321133
I will close this issue as I don't see anything we can do on the node-gyp side for the issues above. If I missed anything, we can always reopen.
For the issues here with the
weak
module:
weak
does not support Node.js v12 or above (see TooTallNate/node-weak#99). You might:* Use Node.js v10 ([only possible until April 2021](https://github.com/nodejs/release#release-schedule)). * If you are depending on `weak` directly, consider using an alternative. `weak-napi` seems to be a possible alternative: https://github.com/node-ffi-napi/weak-napi * If one of your modules depends on `weak`, please check that module's issue tracker for instructions or other issues about this. If there are none, please open a PR or issue there.
For the issues here with the
node-sass
module:
node-sass
does not support VS2019, because it is locked on an old and unsupported version ofnode-gyp
: sass/node-sass#2716 . This is not an issue withnode-gyp
, recent versions support VS2019 and this error would not happen.However,
node-sass
provides prebuilt versions. While running npm install, a prebuilt version should be downloaded automatically. The issue might be thatnode-sass
is not able to download the prebuilt version. Please try to understand why, and open an issue in thenode-sass
issue tracker if help is needed.If you actually need to build
node-sass
, you might have some luck with this workaround: #1753 (comment)
I suppose in the end this ties into my choice to not open node version manager (nvm) and downgrade to the recommended Node 10.x
But, I found this guide , which recommends this command:
npm install --global --production windows-build-tools --vs2015
https://spin.atomicobject.com/2019/03/27/node-gyp-windows/
Because of this note
You can download them by running this command: npm install --global --production windows-build-tools --vs2015
Important note
If you run this command without any additional flags, you’ll install the files associated with the latest version of Visual Studio, which is VS2017 at the time of writing. However, node-gyp requires the v140 distributable, not the v150 (which comes with VS2017). This is why the --vs2015 flag is added to the end of the command, since that’s the last version of Visual Studio that came with the v140 package. You can see more notes about that near the bottom of the package’s website.
Hopefully, that’s all it will take for you to get everything installed. If you’ve still got issues, then you’re going to have to grab all of the required files manually.
Followed by this command:
npm config set msvs_version 2015 --global
I think I may have entered this before but not documented it, which is why I could not reproduce it
And then another command:
npm config set python python2.7
And I found this command in the comments:
npm config set python python2
With this information in hand, I now manually uninstalled the 2017 Windows Build Tools (as documented, using the Visual Studio Installer), and all global npm packages. Then I started fresh in a new Administrative Windows Powershell:
npm install --global --production windows-build-tools --vs2015
npm config set msvs_version 2015 --global
npm config set python python2
At this point, npm install still failed.
So I tried:
npm config set python python2.7
npm install --global node-gyp
I then tried
node-gyp configure
node-gyp build
and
node-gyp rebuild
which gave me the error:
λ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@12.16.1 | win32 | x64
gyp info find Python using Python version 2.7.15 found at "C:\Users\Derek\.windows-build-tools\python27\python.exe"
gyp info find VS using VS2015 (14.0) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Users\Derek\.windows-build-tools\python27\python.exe
gyp info spawn args [
gyp info spawn args 'C:\\Users\\Derek\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-I',
gyp info spawn args 'C:\\dev\\screeps-typescript-starter\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\Derek\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\Derek\\AppData\\Local\\node-gyp\\Cache\\12.16.1\\include\\node\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\Derek\\AppData\\Local\\node-gyp\\Cache\\12.16.1',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\Derek\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\Derek\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\12.16.1\\\\<(target_arch)\\\\node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\dev\\screeps-typescript-starter',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\dev\\screeps-typescript-starter\\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
Warning: Missing input files:
C:\dev\screeps-typescript-starter\build\..\build\Release\binding.node
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
win_delay_load_hook.cc
binding.vcxproj -> C:\dev\screeps-typescript-starter\build\Release\\binding.node
binding.vcxproj -> C:\dev\screeps-typescript-starter\build\Release\binding.pdb (Full PDB)
gyp info ok
I also tried
node-gyp configure --msvs_version=2015
So finally, I installed nvm for Windows https://github.com/coreybutler/nvm-windows/
using the setup for node version manager for Windows from here: https://github.com/coreybutler/nvm-windows/releases
In a Administrative Windows Powershell, I did
nvm install 10.21.1
nvm use 10.21.1
Then I had success with:
npm install
PS C:\dev\screeps-typescript-starter> nvm install 10.20.1
Downloading node.js version 10.20.1 (64-bit)...
Complete
Creating C:\Users\Derek\AppData\Roaming\nvm\temp
Downloading npm version 6.14.4... Complete
Installing npm v6.14.4...
Installation complete. If you want to use this version, type
nvm use 10.20.1
PS C:\dev\screeps-typescript-starter> nvm use 10.20.1
Now using node v10.20.1 (64-bit)
PS C:\dev\screeps-typescript-starter> npm install
> bufferutil@3.0.5 install C:\dev\screeps-typescript-starter\node_modules\screeps-api\node_modules\bufferutil
> prebuild-install || node-gyp rebuild
> utf-8-validate@4.0.2 install C:\dev\screeps-typescript-starter\node_modules\utf-8-validate
> prebuild-install || node-gyp rebuild
> screeps-typescript-starter@3.0.0 install C:\dev\screeps-typescript-starter
> node-gyp rebuild
C:\dev\screeps-typescript-starter>if not defined npm_config_node_gyp (node "C:\Users\Derek\AppData\Roaming\nvm\v10.20.1\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\Derek\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Warning: Missing input files:
C:\dev\screeps-typescript-starter\build\..\build\Release\binding.node
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
win_delay_load_hook.cc
Generating code
All 1 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
Finished generating code
binding.vcxproj -> C:\dev\screeps-typescript-starter\build\Release\\binding.node
binding.vcxproj -> C:\dev\screeps-typescript-starter\build\Release\binding.pdb (Full PDB)
npm WARN @rollup/plugin-multi-entry@3.0.0 requires a peer of rollup@^1.20.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
added 26 packages from 28 contributors and audited 1031 packages in 12.628s
22 packages are looking for funding
run `npm fund` for details
found 1 moderate severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
To make sure it worked, I deleted the node-modules folder and the package-lock.json file, as well, and tried npm install again, but got this error:
PS C:\dev\screeps-typescript-starter> npm install npm WARN deprecated rollup-plugin-buble@0.19.8: This module has been deprecated and is no longer maintained. Please use @rollup/plugin-buble.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated os-homedir@2.0.0: This is not needed anymore. Use `require('os').homedir()` instead.
npm WARN checkPermissions Missing write access to C:\dev\screeps-typescript-starter\node_modules\rollup-plugin-typescript2\node_modules\resolve
npm WARN checkPermissions Missing write access to C:\dev\screeps-typescript-starter\node_modules\rollup-plugin-nodent
npm WARN checkPermissions Missing write access to C:\dev\screeps-typescript-starter\node_modules\rollup-plugin-typescript2\node_modules
npm WARN checkPermissions Missing write access to C:\dev\screeps-typescript-starter\node_modules
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.1 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @rollup/plugin-multi-entry@3.0.0 requires a peer of rollup@^1.20.0 but none is installed. You must install peer dependencies yourself.
npm ERR! code ENOENT
npm ERR! syscall access
npm ERR! path C:\dev\screeps-typescript-starter\node_modules\rollup-plugin-typescript2\node_modules\resolve
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, access 'C:\dev\screeps-typescript-starter\node_modules\rollup-plugin-typescript2\node_modules\resolve'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Derek\AppData\Roaming\npm-cache\_logs\2020-05-01T01_35_32_308Z-debug.log
That crashed, apparently because I was missing the npm package rollup (unmet peer dependency), so I did this and got it to work:
PS C:\dev\screeps-typescript-starter> npm install rollup
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\rollup\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ rollup@2.7.6
added 1 package from 1 contributor and audited 2 packages in 0.908s
found 0 vulnerabilities
PS C:\dev\screeps-typescript-starter> npm install
npm WARN deprecated rollup-plugin-buble@0.19.8: This module has been deprecated and is no longer maintained. Please use @rollup/plugin-buble.
npm WARN deprecated tslint@6.1.2: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated os-homedir@2.0.0: This is not needed anymore. Use `require('os').homedir()` instead.
> bufferutil@3.0.5 install C:\dev\screeps-typescript-starter\node_modules\screeps-api\node_modules\bufferutil
> prebuild-install || node-gyp rebuild
> utf-8-validate@4.0.2 install C:\dev\screeps-typescript-starter\node_modules\utf-8-validate
> prebuild-install || node-gyp rebuild
> bufferutil@4.0.1 install C:\dev\screeps-typescript-starter\node_modules\bufferutil
> node-gyp-build
npm WARN @rollup/plugin-multi-entry@3.0.0 requires a peer of rollup@^1.20.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
added 373 packages from 804 contributors and audited 1031 packages in 24.269s
22 packages are looking for funding
run `npm fund` for details
found 1 moderate severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
Note that all my global npm packages (windows-build-tools and node-gyp) disappeared with nvm, which only gave me the single global package installed of npm@6.14.4 corresponding with my node version 10.21.11 -- I thought I should mention.
Digging further, I did
npm list
which returned
npm ERR! peer dep missing: rollup@^1.20.0, required by @rollup/plugin-multi-entry@3.0.0
so I did
npm install --save-dev "rollup@^1.20.0"
That resulted in:
PS C:\dev\screeps-typescript-starter> npm install --save rollup@^1.20.0 npm WARN rollup-plugin-typescript2@0.27.0 requires a peer of rollup@>=1.26.3 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ rollup@1.20.0
added 2 packages from 42 contributors, updated 1 package and audited 1033 packages in 2.809s
22 packages are looking for funding
run `npm fund` for details
found 1 moderate severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
So I did:
npm install --save rollup@^1.26.3
Which gave me:
PS C:\dev\screeps-typescript-starter> npm install --save rollup@^1.26.3 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ rollup@1.26.3
removed 1 package, updated 1 package and audited 1033 packages in 2.65s
22 packages are looking for funding
run `npm fund` for details
found 1 moderate severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
I think that means it's fully installed and working (thanks to downgrading to Node 10 with nvm)
I went ahead and updated my pull request #136 -- I see now that Node 10 is in fact the dependency, although apparently the support for that will stop in April 2021 or whatever I saw in that other post.
Oh, I also didn't need the binding.gyp file
I think the easiest solution is to use Yarn instead of npm. I use Node 12 and Yarn. I do get that compilation error, but since it's from an optional dependency, Yarn considers it a warning and everything works. And I get to use Node 12 features, which I need for my mocking functions.
I think the easiest solution is to use Yarn instead of npm. I use Node 12 and Yarn. I do get that compilation error, but since it's from an optional dependency, Yarn considers it a warning and everything works. And I get to use Node 12 features, which I need for my mocking functions.
Thanks @eduter , you're right. I think either npm or yarn work, just with those warnings, which I was trying to eliminate. The warning messages were less aggressive in yarn, for what it's worth.
Rolling back to Node 10 let everything compile without warnings for me on Windows 10.
As per #136 it's a good point that Screeps itself is using Node 10, so maybe node version manager is still a good solution if you don't need Node 12 features 😄
I'm a little irked that I got it fixed at one point with Node 12 on Windows but then couldn't reproduce it. 🤷 Have a good one!
@eduter For what it's worth, trying today with nvm (10.20.1) from scratch, yarn (v1.22.4) works fine to compile both those dependencies previously mentioned.
But when I go to add screeps with yarn add screeps, it bails:
error C:\dev\screeps-typescript-starter\node_modules\isolated-vm: Command failed.
Exit code: 1
Command: node-gyp rebuild --release -j 4
Arguments:
Directory: C:\dev\screeps-typescript-starter\node_modules\isolated-vm
Output:
C:\dev\screeps-typescript-starter\node_modules\isolated-vm>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release -j 4 ) else (node "C:\Users\Derek\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --release -j 4 )
gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@10.20.1 | win32 | x64
gyp info find Python using Python version 2.7.15 found at "C:\Users\Derek\.windows-build-tools\python27\python.exe"
gyp info find VS using VS2015 (14.0) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Users\Derek\.windows-build-tools\python27\python.exe
gyp info spawn args [ 'C:\\Users\\Derek\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
It's the same with
yarn add screeps-server-mockup
So I followed this guide https://screeps.com/forum/topic/477/screeps-server-on-windows specifically:
3. From elevated powershell or cmd
npm install --global --production windows-build-tools
[...]
5. From elevated powershell or cmd:
npm install -g screeps
Again, I was still using Node v10 via nvm.
Unfortunately, that barfed some errors while compiling.
Thinking it was node-gyp again, I stuck with the administrative powershell and did:
npm install -g node-gyp
Set-ExecutionPolicy Unrestricted
And set [A] Yes to All for changing the execution policy.
Then when I entered node-gyp it seemed to work, so I tried npm install -g screeps again, but it bailed because files were existing.
So I tried npm install -g screeps --force
That appeared to succeed, albeit with many warnings including some node-gyp stuff:
+ screeps@4.1.6
added 670 packages from 487 contributors in 103.207s
So going back to the screeps-typescript-starter working directory, I started over by doing yarn cache clean:
λ yarn cache clean
yarn cache v1.22.4
success Cleared cache.
Done in 6.00s.
Just to be safe, I did the same with npm to clean the cache:
λ npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.
Followed by npm install -- which succeeded as previously:
C:\dev\screeps-typescript-starter
λ npm install
[lots of warning about deprecated packages]
added 11 packages from 81 contributors, removed 540 packages, updated 241 packages and audited 595 packages in 93.597s
7 packages are looking for funding
run `npm fund` for details
found 9 vulnerabilities (6 low, 1 moderate, 2 high)
run `npm audit fix` to fix them, or `npm audit` for details
Followed by npm install screeps-server-mockup (now that the @screeps dependency was installed globally under my versioned Node 10), which finally succeeded!
C:\dev\screeps-typescript-starter
λ npm install screeps-server-mockup
[lots of warning about deprecated npm packages]
> isolated-vm@2.1.0 install C:\dev\screeps-typescript-starter\node_modules\isolated-vm
> node-gyp rebuild --release -j 4
C:\dev\screeps-typescript-starter\node_modules\isolated-vm>if not defined npm_config_node_gyp (node "C:\Users\Derek\AppData\Roaming\nvm\v10.20.1\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release -j 4 ) else (node "C:\Users\Derek\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --release -j 4 )
[lots of warnings during compilation]
Creating library C:\dev\screeps-typescript-starter\node_modules\isolated-vm\build\Release\isolated_vm.lib and object C:\dev\screeps-typescript-starter\node_module
s\isolated-vm\build\Release\isolated_vm.exp
Generating code
All 10312 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
Finished generating code
isolated_vm.vcxproj -> C:\dev\screeps-typescript-starter\node_modules\isolated-vm\build\Release\\isolated_vm.node
> @screeps/driver@5.1.0 install C:\dev\screeps-typescript-starter\node_modules\@screeps\driver
> node-gyp rebuild -C native && webpack
C:\dev\screeps-typescript-starter\node_modules\@screeps\driver>if not defined npm_config_node_gyp (node "C:\Users\Derek\AppData\Roaming\nvm\v10.20.1\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild -C native ) else (node "C:\Users\Derek\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild -C native )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
main.cc
pf.cc
win_delay_load_hook.cc
Creating library C:\dev\screeps-typescript-starter\node_modules\@screeps\driver\native\build\Release\native.lib and object C:\dev\screeps-typescript-starter\node_
modules\@screeps\driver\native\build\Release\native.exp
Generating code
c:\dev\screeps-typescript-starter\node_modules\@screeps\driver\native\src\pf.h(128): warning C4715: 'screeps::world_position_t::position_in_direction': not all control
paths return a value [C:\dev\screeps-typescript-starter\node_modules\@screeps\driver\native\build\native.vcxproj]
All 596 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
Finished generating code
native.vcxproj -> C:\dev\screeps-typescript-starter\node_modules\@screeps\driver\native\build\Release\\native.node
Executing post-build scripts
Hash: 53b31ef51d0f8642d9c9
Version: webpack 3.12.0
Time: 841ms
Asset Size Chunks Chunk Names
runtime.bundle.js 930 kB 0 [emitted] [big] main
[0] ../engine/src/utils.js 22.8 kB {0} [built]
[2] ../engine/src/game/rooms.js 57.2 kB {0} [built]
[6] (webpack)/buildin/global.js 509 bytes {0} [built]
[13] ./lib/runtime/runtime.js 10.2 kB {0} [built]
[14] (webpack)/buildin/module.js 517 bytes {0} [built]
[17] ../pathfinding/index.js 48 bytes {0} [built]
[18] ../engine/src/game/game.js 26.3 kB {0} [built]
[25] ../engine/src 160 bytes {0} [built]
[32] ../engine/src/game/custom-prototypes.js 1.92 kB {0} [built]
[53] ../engine/src/game/deposits.js 1.58 kB {0} [built]
[54] ../engine/src/game/nukes.js 1.3 kB {0} [built]
[55] ../engine/src/game/resources.js 1.51 kB {0} [built]
[56] ../engine/src/game/flags.js 3.33 kB {0} [built]
[63] ../engine/src/game/console.js 2.62 kB {0} [built]
[64] ./lib/runtime/mapgrid.js 7.37 kB {0} [built]
+ 50 hidden modules
WARNING in ../engine/src/utils.js
27:8-42 Critical dependency: the request of a dependency is an expression
@ ../engine/src/utils.js
@ ./lib/runtime/runtime.js
Runtime snapshot created (4146644 bytes)
> uglifyjs-webpack-plugin@0.4.6 postinstall C:\dev\screeps-typescript-starter\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js
[lots of warnings about skipping optional dependencies]
+ screeps-server-mockup@1.5.1
added 513 packages from 439 contributors, removed 1 package, updated 28 packages and audited 4673 packages in 102.027s
7 packages are looking for funding
run `npm fund` for details
found 44 vulnerabilities (22 low, 3 moderate, 19 high)
run `npm audit fix` to fix them, or `npm audit` for details
From here, I could finally do npm run test with success:
C:\dev\screeps-typescript-starter (Update-node-requirement-from-10.x-to-at-least-10.x -> origin) (screeps-typescript-starter@3.0.0)
λ npm run test
> screeps-typescript-starter@3.0.0 test C:\dev\screeps-typescript-starter
> npm run test-unit && npm run test-integration
> screeps-typescript-starter@3.0.0 test-unit C:\dev\screeps-typescript-starter
> rollup -c rollup.test-unit-config.js && mocha dist/test-unit.bundle.js
test/unit/**/*.test.ts → dist/test-unit.bundle.js...
created dist/test-unit.bundle.js in 2.7s
main
√ should export a loop function
Current game tick is 12345
√ should return void when called with no context
2 passing (28ms)
> screeps-typescript-starter@3.0.0 test-integration C:\dev\screeps-typescript-starter
> npm run build && rollup -c rollup.test-integration-config.js && mocha dist/test-integration.bundle.js
> screeps-typescript-starter@3.0.0 build C:\dev\screeps-typescript-starter
> rollup -c
No destination specified - code will be compiled but not uploaded
cleared: C:\dev\screeps-typescript-starter\dist
src/main.ts → dist/main.js...
created dist/main.js in 2.3s
test/integration/**/*.test.ts → dist/test-integration.bundle.js...
created dist/test-integration.bundle.js in 2.3s
main
√ runs a server and matches the game tick (523ms)
√ writes and reads to memory (342ms)
2 passing (2s)
Hallelujah 🌮 🎉 🥳
These are my steps from the beginning, using an Administrative Powershell (Windows+X, Windows PowerShell (Admin):
npm install --global --production windows-build-tools
npm install -g node-gyp
Set-ExecutionPolicy Unrestricted
npm install -g screeps
I selected [A] for Yes to All about the Windows Execution Policy change, which was necessary to run node-gyp in the Administrative PowerShell.
My environment using nvm (Node Version Manager) is Windows 10 and Node v10.20.1 x64 bit.
That let me run the following inside the screeps-typescript-starter project:
npm install
npm install screeps-server-mockup
npm run test
The integration tests that depend on the screeps server succeed!
To recap, here are my global npm modules: (Windows 10 running Node 10.20.1, 64-bit via nvm)
PS C:\Windows\system32> npm list -g --depth=0
C:\Program Files\nodejs
+-- node-gyp@6.1.0
+-- npm@6.14.4
+-- screeps@4.1.6
`-- windows-build-tools@5.2.2
And my nvm list for confirmation:
C:\dev\screeps-typescript-starter
λ nvm list
14.1.0
12.16.1
* 10.20.1 (Currently using 64-bit executable)
I'm not 100% sure how I would get the windows-build-tools global on yarn, so I did switch back to npm. I guess it doesn't make much difference, though.
(For what it's worth, yarn test is the same as npm test, since yarn test calls what's in the package.json file, which is npm run test-unit && npm run-test-integration... The only difference appears to be that yarn test tells me the whole process took "Done in 17.41s" but I get no such message with npm.)
I had some Windows quirks, where two packages wouldn't get built.
(Maybe I should have just known better, because of the node-gyp dependency.)
then I had to open an Administrative PowerShell with Windows + X, Powershell (Admin), where I had to run
Or equivalently with yarn: yarn global add --production windows-build-tools --vs2017
It looks like that command automatically downloaded Python (2.7)
I had tried installing Python separately, but I think that doesn't matter because the npm command appears to install Python 2.7.
I thought I would need to install it separately, because I got a few errors about Python not being installed, so I had to install it from the Windows Store at https://www.microsoft.com/en-us/p/python-38/9mssztt1n39l
However, it does look like I had to run the VS Build Tools file it downloaded separately (
C:\Users\${username}\.windows-build-tools\vs_BuildTools.exe
) in order to get the npm command to work -- it looks like the version control was slightly off for me (5.1.7 vs 5.2.2).Following that, I had to add that file (
C:\Users\${username}\.windows-build-tools\vs_BuildTools.exe
) to the antivirus software exclusion list (Windows Defender is accessible from Settings -> search Defender to reach Windows Security, click Virus & threat protection, click Manage settings under Virus & threat protection settings, scroll down to Exclusions, click Add an exclusion, click File, paste the Path, click Open, then run the npm install --global --production windows-build-tools --vs2017 command again.)The exact path for the vs_BuildTools.exe file name is at least referenced in the Administrative Powershell output -- even if it fails. That made it was pretty easy to copy & paste to run (by executing in the Administrative Powershell) and to add to the exclusions list.
Doing all this...
Doing all this left me with two ongoing installations that fail:
with this same output
And the results appeared the same in both npm and yarn, as you would expect.
Obviously, these are optional dependencies, but I couldn't figure out how to get them built.
Any ideas?