Cannot npm i, ionic v3, node-sass, app-scripts fails

I have a newly installed Windows 11 machine just cloned an old ionic v3 project.

However it looks like app-scripts has a hard dependency on node-sass 4.10 which is not compatible with node 16.

I have absolutely no idea how to get this old ionic project working again. I don’t really want to downgrade node as this is not really a sustainable solution.

Is there any way someone from ionic can update app-scripts to remove the dep on node-sass with sass, or at the very least update node-sass?

Or is there another way around this, besides having to swap node versions each time?

"ionic-angular": "3.9.10",
"@ionic/app-scripts": "3.2.3",

note that @ionic/app-scripts 3.2.4 also doesn’t work.

Node v16.13.1
npm v8.1.2

The error output:

npm ERR! code 1
npm ERR! path C:\Projects\GalaxyMobile.App\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Projects\GalaxyMobile.App\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
npm ERR! Build started 2022/01/14 20:14:28.
npm ERR! Project "C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\binding.sln" on node 1 (default targets).
npm ERR! ValidateSolutionConfiguration:
npm ERR!   Building solution configuration "Release|x64".
npm ERR! Project "C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\binding.sln" (1) is building "C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\binding.vcxproj.metaproj" (2) on node 1 (default targets).    
npm ERR! Project "C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\binding.vcxproj.metaproj" (2) is building "C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\src\libsass.vcxproj" (3) on node 1 (default targets).
npm ERR! C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
npm ERR! Done Building Project "C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\src\libsass.vcxproj" (default targets) -- FAILED.
npm ERR! Done Building Project "C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\binding.vcxproj.metaproj" (default targets) -- FAILED.
npm ERR! Done Building Project "C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\binding.sln" (default targets) -- FAILED.
npm ERR!
npm ERR! Build FAILED.
npm ERR!
npm ERR! "C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\binding.sln" (default target) (1) ->
npm ERR! "C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\binding.vcxproj.metaproj" (default target) (2) ->
npm ERR! "C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\src\libsass.vcxproj" (default target) (3) ->
npm ERR!   C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
npm ERR!
npm ERR!     0 Warning(s)
npm ERR!     1 Error(s)
npm ERR!
npm ERR! Time Elapsed 00:00:00.31
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli   'C:\\Projects\\GalaxyMobile.App\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.13.1 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "C:\Users\dylan\.windows-build-tools\python27\python.exe" in the PATH
npm ERR! gyp verb `which` succeeded C:\Users\dylan\.windows-build-tools\python27\python.exe C:\Users\dylan\.windows-build-tools\python27\python.exe
npm ERR! gyp verb check python version `C:\Users\dylan\.windows-build-tools\python27\python.exe -c "import sys; print "2.7.15
npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.13.1
npm ERR! gyp verb command install [ '16.13.1' ]
npm ERR! gyp verb install input version string "16.13.1"
npm ERR! gyp verb install installing version: 16.13.1
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 16.13.1
npm ERR! gyp verb build dir attempting to create "build" dir: C:\Projects\GalaxyMobile.App\node_modules\node-sass\build
npm ERR! gyp verb build dir "build" dir needed to be created? C:\Projects\GalaxyMobile.App\node_modules\node-sass\build
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: C:\Projects\GalaxyMobile.App\node_modules\node-sass\build\config.gypi
npm ERR! (node:4560) [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 verb config.gypi checking for gypi file: C:\Projects\GalaxyMobile.App\node_modules\node-sass\config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: C:\Projects\GalaxyMobile.App\node_modules\node-sass\common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "msvs"
npm ERR! gyp info spawn C:\Users\dylan\.windows-build-tools\python27\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Projects\\GalaxyMobile.App\\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   '-G',
npm ERR! gyp info spawn args   'msvs_version=2015',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Projects\\GalaxyMobile.App\\node_modules\\node-sass\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Projects\\GalaxyMobile.App\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\dylan\\.node-gyp\\16.13.1\\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\\dylan\\.node-gyp\\16.13.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Projects\\GalaxyMobile.App\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\Users\\dylan\\.node-gyp\\16.13.1\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Projects\\GalaxyMobile.App\\node_modules\\node-sass',
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:\\Projects\\GalaxyMobile.App\\node_modules\\node-sass\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp verb command build []
npm ERR! gyp verb build type Release
npm ERR! gyp verb architecture x64
npm ERR! gyp verb node dev dir C:\Users\dylan\.node-gyp\16.13.1
npm ERR! gyp verb found first Solution file build/binding.sln
npm ERR! gyp verb could not find "msbuild.exe" in PATH - finding location in registry
npm ERR! gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'build/binding.sln',
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:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Projects\GalaxyMobile.App\node_modules\node-gyp\lib\build.js:262:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390: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.22000
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Projects\\GalaxyMobile.App\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd C:\Projects\GalaxyMobile.App\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.13.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

Hi
Install nvm to manage node versions without fears
Maybe that helps?

In addition to @Tommertom’s excellent advice, I would be very surprised if Ionic v3-era build tools worked with node 16, period, so I think that unless you are planning on porting the app to modern Ionic versions, downgrading node is not only “not sustainable”, but in fact “mandatory”.

1 Like