C:\temp\ionic\test1>npm install
> node-sass@4.9.3 install C:\temp\ionic\test1\node_modules\node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.3/win32-x64-67_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.9.3/win32-x64-67_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
> node-sass@4.9.3 postinstall C:\temp\ionic\test1\node_modules\node-sass
> node scripts/build.js
Building: C:\Program Files\nodejs\node.exe C:\temp\ionic\test1\node_modules\node-gyp\bin\node-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\\nodejs\\node.exe',
gyp verb cli 'C:\\temp\\ionic\\test1\\node_modules\\node-gyp\\bin\\node-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 node-gyp@3.8.0
gyp info using node@11.3.0 | 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 (C:\temp\ionic\test1\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (C:\temp\ionic\test1\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (C:\temp\ionic\test1\node_modules\which\which.js:80:29)
gyp verb `which` failed at C:\temp\ionic\test1\node_modules\which\which.js:89:16
gyp verb `which` failed at C:\temp\ionic\test1\node_modules\isexe\index.js:42:5
gyp verb `which` failed at C:\temp\ionic\test1\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:161:21)
gyp verb `which` failed python2 { Error: not found: python2
gyp verb `which` failed at getNotFoundError (C:\temp\ionic\test1\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (C:\temp\ionic\test1\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (C:\temp\ionic\test1\node_modules\which\which.js:80:29)
gyp verb `which` failed at C:\temp\ionic\test1\node_modules\which\which.js:89:16
gyp verb `which` failed at C:\temp\ionic\test1\node_modules\isexe\index.js:42:5
gyp verb `which` failed at C:\temp\ionic\test1\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:161:21)
gyp verb `which` failed stack:
gyp verb `which` failed 'Error: not found: python2\n at getNotFoundError (C:\\temp\\ionic\\test1\\node_modules\\which\\which.js:13:12)\n at F (C:\\temp\\ionic\\test1\\node_modules\\which\\which.js:68:19)\n at E (C:\\temp\\ionic\\test1\\node_modules\\which\\which.js:80:29)\n at C:\\temp\\ionic\\test1\\node_modules\\which\\which.js:89:16\n at
C:\\temp\\ionic\\test1\\node_modules\\isexe\\index.js:42:5\n at C:\\temp\\ionic\\test1\\node_modules\\isexe\\windows.js:36:5\n at FSReqCallback.oncomplete (fs.js:161:21)',
gyp verb `which` failed code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Users\lucch\AppData\Local\Programs\Python\Python37-32\python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\lucch\AppData\Local\Programs\Python\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at maybeClose (internal/child_process.js:978:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\temp\\ionic\\test1\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\temp\ionic\test1\node_modules\node-sass
gyp ERR! node -v v11.3.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.9.3 (node_modules\node-sass):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.9.3 postinstall: `node scripts/build.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
audited 49790 packages in 6.363s
found 0 vulnerabilities
I’ve downloaded and installed Python on my machine, added it to the path and it doesn’t make any difference. I might find a solution to this by messing around but I’m documenting it for newcomers to Ionic. If you follow the “getting started” procedures on the Ionic page, this should work out of the box and not require any messing around. I’ve been working on an app since Ionic v1 and rebuilt it many times (currently rebuilding it in the latest Ionic v4) so I don’t know what my old machine has installed to fix this problem anymore. What does a new machine need to have installed to make this work?
I’ll try rolling back to node 10 first and see what that does.
The node-sass version app-scripts is using doesn’t support Node 11. This is a common problem on Windows, where the bindings have to be downloaded instead of created locally. But you found the correct and best solution for that.
Installing a newer version of node-sass manually would probably fix the problem, if they have already published the bindings for the newest Node (I am also still on Node 10, so I don’t know).
Sooner or later Ionic will release a new version of Ionic app scripts, that will include the newer node-sass by itself. But as there could be other, unrelated changes in there, that has to be tested well. (If you do test it by using the latest, you could create a PR to app-scripts if you are convinced that the versions work well together)
Wasn’t it Dilbert’s boss who said half of his job was just knowing what to name stuff?
Actually, I DID find a major advantage in upgrading to Node 11. My build time goes down by 72%! I use a new project with 100 pages to benchmark my build time. With Node 10, it takes 13s to refresh after each modification. With Node 11, it’s down to 3.7s! So installing node-sass locally is not a big sacrifice when you look at the new build times. My biggest pain point developing with Ionic/Angular was the build time between changes so this is MAJOR upgrade for me!
I am getting another problem when running with Node 11.3 though. When I clone my project and run npm install, I’m getting errors about not finding Python.exe (which I did install on this machine).
This is a project that uses two plugins: onesignal-cordova-plugin and cordova-plugin-device.
What else am-I missing? Here’s the log from my npm install:
C:\MTC\mtc3-client>npm install
> grpc@1.13.1 install C:\MTC\mtc3-client\node_modules\grpc
> node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/g
rpc/v1.13.1/node-v67-win32-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for grpc@1.13.1 and node@11.3.0 (node-v67 ABI, unknown) (f
alling back to source compile with node-gyp)
node-pre-gyp WARN Pre-built binaries not installable for grpc@1.13.1 and node@11.3.0 (node-v67 ABI, unkno
wn) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\lucch\AppData\Local\Programs\Python\Python37-32\python.EXE
-c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at maybeClose (internal/child_process.js:978:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\nod
e_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--mo
dule=C:\\MTC\\mtc3-client\\node_modules\\grpc\\src\\node\\extension_binary\\node-v67-win32-x64-unknown\\g
rpc_node.node" "--module_name=grpc_node" "--module_path=C:\\MTC\\mtc3-client\\node_modules\\grpc\\src\\no
de\\extension_binary\\node-v67-win32-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd C:\MTC\mtc3-client\node_modules\grpc
gyp ERR! node -v v11.3.0
gyp ERR! node-gyp -v v3.8.0
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\nodej
s\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_l
ibrary --module=C:\MTC\mtc3-client\node_modules\grpc\src\node\extension_binary\node-v67-win32-x64-unknown
\grpc_node.node --module_name=grpc_node --module_path=C:\MTC\mtc3-client\node_modules\grpc\src\node\exten
sion_binary\node-v67-win32-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stackgyp at ChildProcess.<anonymous> (C:\MTC\mtc3-client\node_modules\grpc\node_mod
ules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! ERR!stack at ChildProcess.emit (events.js:182:13)
configure errornode-pre-gyp
ERR! stack at maybeClose (internal/child_process.js:978:16)
gypnode-pre-gyp ERR!ERR! stackstack Error: Command failed: C:\Users\lucch\AppData\Local\Programs\Python
\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
gyp ERR!node-pre-gyp stackERR! File "<string>", line 1
gypSystem Windows_NT 10.0.17763
ERR!node-pre-gyp stackERR! import sys; print "%s.%s.%s" % sys.version_info[:3];
gypcommand "C:\\Program Files\\nodejs\\node.exe" "C:\\MTC\\mtc3-client\\node_modules\\grpc\\node_module
s\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
ERR! node-pre-gyp stackERR! ^
gypcwd C:\MTC\mtc3-client\node_modules\grpc
ERR!node-pre-gyp stackERR! SyntaxError: invalid syntax
gypnode -v v11.3.0
ERR!node-pre-gyp stackERR!
gypnode-pre-gyp -v v0.10.3
ERR!node-pre-gyp stackERR! at ChildProcess.exithandler (child_process.js:294:12)
gypnot ok
ERR! stack at ChildProcess.emit (events.js:182:13)
gypFailed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modu
les\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=C:\MTC\mtc3-
client\node_modules\grpc\src\node\extension_binary\node-v67-win32-x64-unknown\grpc_node.node --module_nam
e=grpc_node --module_path=C:\MTC\mtc3-client\node_modules\grpc\src\node\extension_binary\node-v67-win32-x
64-unknown --napi_version=3 --node_abi_napi=napi' (1)
ERR! stack at maybeClose (internal/child_process.js:978:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
gyp ERR! [ ......] | install: info lifecycle grpc@1.13.1~install: Failed to exec install scrip
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darw
in","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.13.1 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.13.1 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\lucch\AppData\Roaming\npm-cache\_logs\2018-12-13T16_54_10_632Z-debug.log
You know the drill already:
Some library, this time node-pre-gyp needs some bindings for node + Windows. Your node version is not available in the node-pre-gyp that is being installed, so it tries to build it locally using Python. The “invalid syntax” could mean that it expects to use Python 2 but you have installed Python 3 (this is just a guess). So now you could see if installing the newest node-pre-gyp fixes things, or try to fix the Python problem. Both can work - but can also cause problems down the line.
Your reason for upgrading is a very valid one though.
Well I noticed when installing Node that it was requesting to install BoxStarter and Chocolatey and I hate installing stuff I don’t need but I decided to uninstall node and reinstall with this option enabled. Node installs and then a powershell pops up and tells you it’ll need 3 gigs of space and will reboot your computer a few times. Scary! But I’m jammed at the moment and I’m tired of burning sage to ward off evil spirits in my computer so I let it install. It offered to install Python 2.7 so I first uninstalled Python 4.x that I had on and let it run.
It installed BoxStarter and Chocolatey and a few more things and ended up with a fail code for a package. I’ll try reinstalling it next but for now, I rebooted, deleted my node_modules folder and ran npm install again. This time the message is different. Still a fail but different:
grpc@1.13.1 install C:\MTC\mtc3-client\node_modules\grpc
> node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.13.1/node-v67-win32-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for grpc@1.13.1 and node@11.3.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Pre-built binaries not installable for grpc@1.13.1 and node@11.3.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
Traceback (most recent call last):
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
sys.exit(gyp.script_main())
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main
return main(sys.argv[1:])
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main
return gyp_main(args)
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 523, in gyp_main
generator.GenerateOutput(flat_list, targets, data, params)
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2025, in GenerateOutput
version=msvs_version)
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSNew.py", line 213, in __init__
self.Write()
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSNew.py", line 340, in Write
f.close()
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\common.py", line 393, in close
os.rename(self.tmp_path, filename)
WindowsError: [Error 183] Cannot create a file when that file already exists
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=C:\\MTC\\mtc3-client\\node_modules\\grpc\\src\\node\\ex
tension_binary\\node-v67-win32-x64-unknown\\grpc_node.node" "--module_name=grpc_node" "--module_path=C:\\MTC\\mtc3-client\\node_modules\\grpc\\src\\node\\extension_binary\\node-v67-win32-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd C:\MTC\mtc3-client\node_modules\grpc
gyp ERR! node -v v11.3.0
gyp ERR! node-gyp -v v3.8.0
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 configure --fallback-to-build --library=static_library --module=C:\MTC\mtc3-client\node_modules\grpc\src\nod
e\extension_binary\node-v67-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\MTC\mtc3-client\node_modules\grpc\src\node\extension_binary\node-v67-win32-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\MTC\mtc3-client\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:978:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Windows_NT 10.0.17763
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\MTC\\mtc3-client\\node_modules\\grpc\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd C:\MTC\mtc3-client\node_modules\grpc
node-pre-gyp ERR! node -v v11.3.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
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 configure --fallback-to-build --library=static_library --module=C:\MTC\mtc3-client\node_modules\grpc\src\node\extension_binary\node-v67-win
32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\MTC\mtc3-client\node_modules\grpc\src\node\extension_binary\node-v67-win32-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.13.1 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.13.1 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\lucch\AppData\Roaming\npm-cache\_logs\2018-12-13T18_23_36_209Z-debug.log
I know at this point that this probably has nothing to do with Ionic but new users (or anyone upgrading to Node 11) will probably go through this problem. So installing Python 2.7 seems to fix something but I’m not out of the woods yet. What else do you see?
Hmmm… found the solution. Very anticlimactic. In short, I deleted the package-lock.json.
No need to install anything else (node-sass, windows-build-tools, etc…)
I created a new project and in which npm install works just fine. Then I started copying files from the faulty project to the new until it caused the crash. When I transferred package-lock.json, that’s where it crashed. So I deleted it and ran npm install again. Worked fine.
So I went in my old project and renamed package-lock.json to package-lock-old.json (to be able to compare). npm install works just fine now and I’m able to run ionic serve fine also.
I ran a comparison between the two package-lock files and here is the major difference:
Updated version of firebase from 5.5.5 to 5.7.0 with a dependency upgrade from grpc 1.13.1 to 1.16.1
It’s one of those solutions where you spend a good minute blinking at the screen and wishing you could get your day back.