-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
I have a large existing project that I'm trying to move to Npm 7 and workspaces. (I'm trying to cut it down to something I can share, but that's a lot more work than I hope is necessary.)
The project has 3 "sub-projects" that historically have been "managed" with a package.json#script
like: yarn --cwd sub-project
(I'm also moving away from Yarn).
These sub-packages already had package.json
files with large lists of dependencies.
First I tried npm init -w ui -w daemon -w deploy
but that just regenerated my sub-packages' package.json
files.
Then I realized all that was needed was to add package.json#worksapces
array of the 3 folder names.
So I cleared all my node_modules
folders and all the package-lock.json
files (I was doing a bunch of updates with ncu
as well).
Then I run npm install --legacy-peer-deps
because I have some peerDependencies
that apparently need it.
However there is always an error.
One of those errors is a encoding/code page issue (running in Windows Terminal PowerShell):
npm ERR! path C:\Users\camer\git\Project\node_modules\usb
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c prebuild-install --runtime napi --target 4 --verbose || node-gyp rebuild
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
npm ERR! core.c
npm ERR! descriptor.c
npm ERR! hotplug.c
npm ERR! io.c
npm ERR! strerror.c
npm ERR! c:\users\camer\git\project\node_modules\usb\libusb\libusb\strerror.c(108): warning C4566: character represented by universal-character-name '\u0423' cannot be represented in the current code page (1252) [C:\Users\camer\git\Project\node_modules\usb\build\libusb.vcxproj]
[...]
npm ERR! c:\users\camer\git\project\node_modules\usb\libusb\libusb\strerror.c(121): warning C4566: character represented by universal-character-name '\u043A' cannot be represented in the current code page (1252) [C:\Users\camer\git\Project\node_modules\usb\build\libusb.vcxproj]
npm ERR! sync.c
npm ERR! poll_windows.c
npm ERR! threads_windows.c
npm ERR! windows_usb.c
npm ERR! c:\users\camer\git\project\node_modules\usb\libusb\libusb\os\windows_usb.c(2558): warning C4018: '<': signed/unsigned mismatch [C:\Users\camer\git\Project\node_modules\usb\build\libusb.vcxproj]
npm ERR! win_delay_load_hook.cc
npm ERR! libusb.vcxproj -> C:\Users\camer\git\Project\node_modules\usb\build\Release\\libusb.lib
npm ERR! node_usb.cc
npm ERR! c:\users\camer\git\project\node_modules\usb\libusb\libusb\libusb.h(740): warning C4200: nonstandard extension used: zero-sized array in struct/union [C:\Users\camer\git\Project\node_modules\usb\build\usb_bindings.vcxproj]
npm ERR! c:\users\camer\git\project\node_modules\usb\libusb\libusb\libusb.h(740): note: This member will be ignored by a defaulted constructor or copy/move assignment operator
npm ERR! c:\users\camer\git\project\node_modules\usb\libusb\libusb\libusb.h(771): warning C4200: nonstandard extension used: zero-sized array in struct/union [C:\Users\camer\git\Project\node_modules\usb\build\usb_bindings.vcxproj]
npm ERR! c:\users\camer\git\project\node_modules\usb\libusb\libusb\libusb.h(771): note: This member will be ignored by a defaulted constructor or copy/move assignment operator
npm ERR! c:\users\camer\git\project\node_modules\usb\libusb\libusb\libusb.h(1265): warning C4200: nonstandard extension used: zero-sized array in struct/union [C:\Users\camer\git\Project\node_modules\usb\build\usb_bindings.vcxproj]
npm ERR! c:\users\camer\git\project\node_modules\usb\libusb\libusb\libusb.h(1265): note: This member will be ignored by a defaulted constructor or copy/move assignment operator
npm ERR! c:\users\camer\git\project\node_modules\usb\node_modules\node-addon-api\napi.h(4): fatal error C1083: Cannot open include file: 'node_api.h': No such file or directory [C:\Users\camer\git\Project\node_modules\usb\build\usb_bindings.vcxproj]
npm ERR! prebuild-install info begin Prebuild-install version 5.3.6
npm ERR! prebuild-install info install installing standalone, skipping download.
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.9.6 found at "C:\Python39\python.exe"
npm ERR! gyp info find VS using VS2017 (15.9.28307.1146) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! (node:26220) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn C:\Python39\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:\\Users\\camer\\git\\Project\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\camer\\git\\Project\\node_modules\\usb\\build\\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\camer\\git\\Project\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\camer\\AppData\\Local\\node-gyp\\Cache\\16.4.0\\include\\node\\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\\Users\\camer\\AppData\\Local\\node-gyp\\Cache\\16.4.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\camer\\git\\Project\\node_modules\\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\camer\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.4.0\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'C:\\Users\\camer\\git\\Project\\node_modules\\usb\\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (C:\Users\camer\git\Project\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Users\\camer\\git\\Project\\node_modules\\node\\bin\\node.exe" "C:\\Users\\camer\\git\\Project\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\camer\git\Project\node_modules\usb
npm ERR! gyp ERR! node -v v16.4.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
Full log: 2021-07-01T20_43_41_461Z-debug.log
If I run npm install --legacy-peer-deps
again, it usually fails much faster with a simpler message:
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm ERR! Tracker "idealTree:inflate:" already exists
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\camer\AppData\Local\npm-cache\_logs\2021-07-01T20_17_00_868Z-debug.log
Full log: 2021-07-01T20_17_00_868Z-debug.log
I used to be able to wipe away my node_modules
folder for this error to temporarily go away (only to return on re-run).
Testing again to generate full accurate logs, now the node_modules
folder is cleared away on error...
Expected Behavior
- No error, or an error that describes what I need to fix on my system.
- All packages for all workspaces installed.
Steps To Reproduce
- Checkout fresh/clean repo with workspace and certain package dependencies (maybe
peerDependencies
) - Run
npm install --legacy-peer-deps
- See error...
Environment
- OS: Windows 10 x64
- System Node:
14.17.1
node
as dependency:16.4.0
- npm:
7.19.1