Why doesn't npm start or npm install work? - node.js

I'm just getting started with react/firebase/expo so I'm really baffled on this one.
I'm not even sure how to explain what's happening, but basically if I try to run "npm install", I get the following output on the console:
E:\Visual Studio\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.WindowsSDK.targets(46,5): error MSB8036: The Windows SDK version 10.0.18362.0 was not found. Install the required version of Windows SDK or change the SDK version in the project p
roperty pages or by right-clicking the solution and selecting "Retarget solution". [C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\grpc\build\z.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `E:\Visual Studio\MSBuild\Current\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:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Windows_NT 10.0.18363
Whole output is here: https://pastebin.com/85kSH3qt
If I run npm start, EXPO tells me
ERROR warn Package firebase has been ignored because it contains invalid configuration. Reason: Cannot find module 'firebase\package.json'
Require stack:
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\tools\config\resolveNodeModuleDir.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\tools\releaseChecker\index.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\commands\start\runServer.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\commands\start\start.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\commands\index.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\index.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\local-cli\cli.js
I really have no clue what's happening. I'm trying to work on a shared repo and everyone else is managing to work just fine. I don't know if this is from a single cause, two different causes, or what is happening. Any help is appreciated, as I've been fighting this problem for the last day with no success.

Related

Error running npm install, returns This is a bug in `node-gyp`

I am new to Angular and Node. I am trying to execute an project created using Angular, Neo4j.
At first, I tried to run it as it is. However, i am givem the following error after opening the browser:
NullInjectorError: StaticInjectorError(AppModule)[RouterScroller -> >ViewportScroller]:
StaticInjectorError(Platform: core)[RouterScroller -> ViewportScroller]:
NullInjectorError: No provider for ViewportScroller!
ERROR Error: Uncaught (in promise): Neo4jError: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you have enabled encryption, ensure your browser is configured to trust the certificate Neo4j is configured to use. WebSocket readyState is: 3
Neo4jError: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you have enabled encryption, ensure your browser is configured to trust the certificate Neo4j is configured to use. WebSocket readyState is: 3
Then, I tried an clean install following this process:
Delete the node_modules from project;
Run npm install --global windows-build-tools
Run npm install
Then i am given this error:
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
gyp ERR! stack at onErrorNT (internal/child_process.js:465:16)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\USER_NAME\\PROJECT\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\USER_NAME\PROJECT\node_modules\node-sass
gyp ERR! node -v v14.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! <https://github.com/nodejs/node-gyp/issues>
Sorry for the wall of text. Any suggestions to solve this problem?
Edit:
I've also tried the following:
Rebuilding the node-gyp bindings by running node-gyp rebuild, however that returns the following error:
binding.gyp not found while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! node -v v14.15.1 gyp ERR! node-gyp -v v7.1.2
I can confirm that node-gyp is installed globally because I ran: npm install -g node-gyp
I tried the gyp rebuild using python 2.7.18 to no avail. Still returning the same error.
Edit 2:
I no longer have access to the project. So I cannot test any new solutions pointed.
Regardless, Thank you guys for the help.
This is a known canvas issue, probably caused by missing native libs.
Try this see if it helps:
sudo npm uninstall -g node-gyp
sudo npm install -g node-gyp
brew install pkg-config cairo libpng jpeg giflib
npm i canvas
For me this was solved by using Node Version 14
tested with docker first docker pull node:14.10.0

Azure Devops VSTS build agent using different version of Node

Locally the project I have runs fine and the npm install command completes successfully. I am using Node 11.5 and recently installed file-loader with no issues.
However when I pushed the build to VSTS and it ran the 'npm install' command I noticed in the log output that for some reason its using Node 12.13 whereas up until this point it had been Node 11.5. The command did not finish successfully and failed with the following:
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code:
1
gyp ERR! stack at ChildProcess.onExit
(D:\a\1\s\Navico.Global\Navico.Global.Web\node_modules\node-
gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit
(internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe"
"D:\\a\\1\\s\\Navico.Global\\Navico.Global.Web\\node_modules\\node-
gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--
libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\a\1\s\Navico.Global\Navico.Global.Web\node_modules\node-
sass
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm verb lifecycle node-sass#4.10.0~postinstall: unsafe-perm in lifecycle true
What I have tried so far:
Commit package-lock.json as did not commit it at first.
Updated Node-sass from 4.9 to 4.10.
Added file-loader to dependencies in package.json.
I am guessing something recently added (file-loader) is causing something to tell the build agent on VSTS to use Node 12.13 instead of 11.5 but not sure where to look. I am new to VSTS I have used TeamCity before and if we ever had any issues with build agents we could just remote onto the agent and fix the issue but not sure how/if that is possible in VSTS.
Any help will be greatly appreciated!
Thanks, James
If you want to sure about the version of node that is being used during your build add the 'Node.js tool Installer' task. in the task you can define the exact version of node that will be used. this will make sure that your build will run more predictably in the future regardless of changes to the default version used by the Microsoft agents.
I was having a similar problem. I tried the above answer and was still having an issue. Once I changed the solution in VSTS to build with VS2017 instead of "latest" my build started working again.
Looks like Microsoft recently upgraded tooling on their hosted agent.
I deleted package-lock and pushed changes and the build works as expected

Certificate error was raised when installing oracledb in Electron app

I am running Windows 7 with oracledb v1.10.0, electron-prebuilt v1.2.2, electron-rebuild v1.1.5, node v0.12.7, and npm v2.11.3. When I execute node_modules/.bin/electron-rebuild -f -w oracledb, I receive the following error:
gyp ERR! stack Error: certificate not trusted
gyp ERR! stack at Error (native)
gyp ERR! stack at TLSSocket.<anonymous> (_tls_wrap.js:929:36)
gyp ERR! stack at TLSSocket.emit (events.js:104:17)
gyp ERR! stack at TLSSocket._finishInit (_tls_wrap.js:460:8)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "H:\\electron-quick-start\\node_modules\\electron-rebuild\\node_modules\\npm\\node_modules\\node
-gyp\\bin\\node-gyp.js" "install" "--target=1.2.7" "--arch=x64" "--dist-url=https://gh-contractor-zcbenz.s3.amazonaws.co
m/atom-shell/dist"
gyp ERR! cwd H:\electron-quick-start
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
How can I get this command to successfully execute?
It seems to be Module did not self register. On Windows, 'node' is actually a batch file that calls iojs and native modules don't like that. You will need to copy your iojs executable to 'node' as well to satisfy native modules.
Now, I am unclear about exactly what your attempting. But if you would like to utilize a native module from within Electron, you will need to build your native code against the Electron includes/header, not those of iojs. You can take a look at this for an example of the command syntax:
node-gyp rebuild --target=0.22.3 --arch=ia32 --target_platform=win --dist-url=https://atom.io/download/atom-shell
The certificate error I was getting was due to being behind a corporate firewall under Windows. To solve that, I removed the s from https so the dist-url value became http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist. The other error I was getting was (as mentioned by #Thennarasan) "Module did not self-register" and to solve that I called the following commands and it worked:
PS H:\electron-app> cd node_modules\oracledb
PS H:\electron-app\node_modules\oracledb> node-gyp rebuild --target=1.2.8 --arch=x64 --target_platform=win --dist-url=http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist --msvs_version=2013
PS H:\electron-app> cd ..\..
I got help from this Github issue https://github.com/electron/electron/issues/1529.

Receiving Fatal Error c1083, Cannot open include file stddef.h while building node-gyp in Aurelia Project

I am been facing this problem for weeks now, with no hope of being solved. I am new to Aurelia JavaScript Framework and I am getting grips around the skeleton project hosted on github.
I have successfully installed nodejs, npm and jspm. As part of the requirements I am supposed to run:
npm install
The code runs well but hits a block with the error below
C:\Users\baba\.node-gyp\4.4.5\include\node\v8.h(18): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory [E:\fwb\node_modules\u
tf-8-validate\build\validation.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:\Users\baba\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\nodejs\\node.exe" "C:\\Users\\baba\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\fwb\node_modules\utf-8-validate
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
I don't know what I am missing or doing wrong. I would appreciate any help out there to get this running without any error or to put me in a step into the right direction to solve this.
Thank you.
This usually happens because you do not have the necessary build tools on your computer to build the package.
On Unix make sure you have:
python (v2.7 recommended, v3.x.x is not supported)
make
A proper C/C++ compiler toolchain, like GCC
On Mac OS X:
Xcode
You also need to install the Command Line Tools via Xcode. You can find this under the menu Xcode -> Preferences -> Downloads
This step will install gcc and the related toolchain containing make
On Windows:
Visual C++ Build Environment:
Option 1: Install Visual C++ Build Tools using the Default Install option.
Option 2: Install Visual Studio 2015 (or modify an existing installation) and select Common Tools for Visual C++ during setup. This also works with the free Community and Express for Desktop editions.

NPM install error - node-gyp

Trying to install xml-stream package but it keeps failing building dependencies. It seems to require vc2010(vcbuild.exe) but i installed the .Net Framework 2.0 SDK which has the vcbuild file and I'm getting the following error while installing xml-stream:
> node-expat#2.0.0 install G:\Pessoal\node\bugzilla\node_modules\xml-stream\node
_modules\node-expat
> node-gyp rebuild
G:\Pessoal\node\bugzilla\node_modules\xml-stream\node_modules\node-expat>node "D
:\Bin\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\
node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
The following error has occurred during XML parsing:
File: G:\Pessoal\node\bugzilla\node_modules\xml-stream\node_modules\node-expa
t\build\deps\libexpat\expat.vcproj
Line: 1
Column: 4916
VCBUILD : error Message: [G:\Pessoal\node\bugzilla\node_modules\xml-stream\nod
e_modules\node-expat\build\binding.sln]
Erro de sistema: -2147154687.
The file 'G:\Pessoal\node\bugzilla\node_modules\xml-stream\node_modules\node-
expat\build\deps\libexpat\expat.vcproj' has failed to load.
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\Bin\nodejs\node_modules\npm\node_m
odules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:
12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "D:\\Bin\\nodejs\\node_modules\\npm\\node_modules\\node-
gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd G:\Pessoal\node\bugzilla\node_modules\xml-stream\node_modules\node-
expat
gyp ERR! node -v v0.10.30
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok
I believe this is happening because xml-stream depends on node-expat which depends on node-gyp which on windows will require you to either install VS2007 or in some other way install the correct SDK required by node-gyp.
In my case I did not wish to jump through those hoops and found it easier to simply use sax to write a very simple XML parser with no dependency on node-gyp.
I placed it on NPM: https://www.npmjs.com/package/no-gyp-xml-stream
Or just run: npm install no-gyp-xml-stream
It's still a work in progress but it works it's easy to use and it will allow you to read large XML files over a stream returning child elements via a call back. And it's only dependency is sax which will not require you to install anything.

Resources