gatsby-cli installation is not recognising current Node version - javascript

I'm trying to install gatsby-cli in Ubuntu 18.04 using the command sudo npm install -g gatsby-cli.
My Node version is 16.14.2 and npm 8.5.0.
But gatsby installation does not recognise these versions. It keeps saying that my current versions are Node 8.5.0 and npm 3.5.2, causing installation errors as you can see in the terminal output below.
What can I do to fix this?
WARN engine gatsby-cli#4.13.0: wanted: {"node":">=14.15.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
loadDep:yurnalist → addNa
WARN engine execa#5.1.1: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
loadDep:yurnalist → addNa
loadDep:yurnalist → resol
WARN engine gatsby-telemetry#3.13.0: wanted: {"node":">=14.15.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine boxen#5.1.2: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine gatsby-core-utils#3.13.0: wanted: {"node":">=14.15.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine semver#7.3.7: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine hosted-git-info#3.0.8: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
loadDep:is-wsl → 304
loadDep:wrap-ansi → resol
WARN engine type-fest#0.20.2: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
loadDep:typedarray-to-buf
loadDep:strip-final-newli
loadDep:mimic-fn → addNam
loadDep:tmp → request
npm ERR! Linux 4.15.0-176-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "gatsby-cli"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code EMISSINGARG
npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror <http://github.com/npm/npm/issues>
WARN engine tmp#0.2.1: wanted: {"node":">=8.17.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine import-from#4.0.0: wanted: {"node":">=12.2"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine got#11.8.3: wanted: {"node":">=10.19.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
npm ERR! Please include the following file with any support request:
npm ERR! /home/development/blog-gatsby/npm-debug.log

I managed to fix the error above. The problem was that, even using yarn or npm without sudo, the installation process happened with the Node version installed for the root user, which was 8.10.0.
To fix that, I logged as a root user and did:
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
After that, the command gatsby was installed with no issues with the command sudo npm install -g gatsby-cli.
Hope this could be helpful for someone.

Related

I Cant install puppeteer

I ran this script -> npm i --save-dev puppeteer to install puppeteer for e2e testing purposes.
But there is an error while installing:
C:\Users\Mora\Desktop\JS\Testing>npm i --save-dev puppeteer
> puppeteer#13.1.3 install C:\Users\Mora\Desktop\JS\Testing\node_modules\puppete
er
> node install.js
ERROR: Failed to set up Chromium r950341! Set "PUPPETEER_SKIP_DOWNLOAD" env vari
able to skip download.
Error: Download failed: server returned code 403. URL: https://storage.googleapi
s.com/chromium-browser-snapshots/Win/950341/chrome-win.zip
at C:\Users\Mora\Desktop\JS\Testing\node_modules\puppeteer\lib\cjs\puppeteer
\node\BrowserFetcher.js:367:27
at ClientRequest.requestCallback (C:\Users\Mora\Desktop\JS\Testing\node_modu
les\puppeteer\lib\cjs\puppeteer\node\BrowserFetcher.js:493:13)
at Object.onceWrapper (events.js:483:26)
at ClientRequest.emit (events.js:376:20)
at HTTPParser.parserOnIncomingClient (_http_client.js:647:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
at TLSSocket.socketOnData (_http_client.js:515:22)
at TLSSocket.emit (events.js:376:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
npm WARN js-testing-introduction#1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.3.2 (node_modules\fse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#
2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"
})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\wa
tchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#
1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32
"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer#13.1.3 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer#13.1.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Mora\AppData\Roaming\npm-cache\_logs\2022-02-06T10_19_25_3
69Z-debug.log
How can i fix this?
It looks like it is not able to download chromium from https://storage.googleapis.com/chromium-browser-snapshots/Win/950341/chrome-win.zip.
Check whether your network is e.g behind a proxy or storage.googleapis.com was blocked by the firewall.
// do not install a puppeteer
ran this script -> npm install --ignore-scripts puppeteer

Grunt error "Grunt attempted to load a .coffee file but CoffeeScript was not installed."

I am following this tutorial to test the AppRTC project that was created with WebRTC. Before starting the app server I need to run this command line "grunt build" to recompile the App Engine package.
When I run this command line grunt build there are error messages displayed :
Loading "jinja.coffee" tasks...ERROR
>> Error: Grunt attempted to load a .coffee file but CoffeeScript was not installed.
>> Please run `npm install --dev coffeescript` to enable loading CoffeeScript.
Running "shell:buildAppEnginePackage" (shell) task
fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Running "shell:genJsEnums" (shell) task
src >>> src/web_app/js
Running "shell:copyAdapter" (shell) task
Running "shell:copyJsFiles" (shell) task
Done.
After I run this command line npm install --dev coffeescript to install CoffeeScript but I get another error message
npm WARN install Usage of the `--dev` option is deprecated. Use `--include=dev` instead.
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: undefined
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64
Later i tried to install CoffeeScript again with this command line npm install --include=dev coffeescript because the previous command line is obsolete. But I still get the error in my command line :
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: undefined
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-03-11T15_42_35_280Z-debug.log
I can't seem to see where problem is coming from, I have tried all three of these command line to fix this error, but it doesn't work.

I am installing polymer in visual studio code but there are many errors I am getting a lot of errors

C:\Program Files\nodejs>npm install -g bower
npm WARN deprecated bower#1.8.8: We don't recommend using Bower for new projects. Please consider Yarn and Webpack or Parcel. You can read how to migrate legacy project here: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
C:\Users\Deepanshi\AppData\Roaming\npm\bower -> C:\Users\Deepanshi\AppData\Roaming\npm\node_modules\bower\bin\bower
bower#1.8.8
added 1 package from 1 contributor in 14.243s
C:\Program Files\nodejs>npm install -g polymer-cli#next
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules\polymer-cli\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":"ia32"})
npm ERR! code EEXIST
npm ERR! path C:\Users\Deepanshi\AppData\Roaming\npm\node_modules\polymer-cli\bin\polymer.js
npm ERR! dest C:\Users\Deepanshi\AppData\Roaming\npm\polymer
npm ERR! EEXIST: file already exists, cmd shim 'C:\Users\Deepanshi\AppData\Roaming\npm\node_modules\polymer-cli\bin\polymer.js' -> 'C:\Users\Deepanshi\AppData\Roaming\npm\polymer'
npm ERR! File exists: C:\Users\Deepanshi\AppData\Roaming\npm\polymer
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Deepanshi\AppData\Roaming\npm-cache_logs\2020-10-07T12_56_44_680Z-debug.log
Try this :
npm i -g --force npm (note the --force flag)
If your output is get running npm install -g npm:
You can fix it with "brew reinstall node"
So :
brew reinstall node
npm i -g --force npm

sh: node: command not found - when npm install command on AWS Instance

I want to run a node app on AWS EC2 instance. I installed node through this official method by AWS Doc https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html.
Then, I can view the version of node and npm but when I give the command npm install on the node app folder , it starts to install a few dependencies and then it fails. with the error as
> core-js#2.6.11 postinstall /var/apps/backend-master/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
sh: node: command not found
npm WARN mysql_db#1.0.0 No description
npm WARN mysql_db#1.0.0 No repository field.
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":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! core-js#2.6.11 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the core-js#2.6.11 postinstall 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! /root/.npm/_logs/2020-06-16T19_28_07_911Z-debug.log
Do let me know if there is an additional step to do or if I am wrong somewhere

Why isn't anything installing on Node.js?

Today I decided to try out creating a discord bot in Node.js. When I went to install it, I started getting errors. I started to search the internet to find the solution, when I found out nothing was installing. For example,
C:\Users\aidan\Documents\discord bot>npm install --global --production windows-build-tools
npm WARN engine windows-build-tools#1.2.1: wanted: {"node":">=4.0.0"} (current: {"node":"0.12.2","npm":"2.7.4"})
npm WARN engine request#2.81.0: wanted: {"node":">= 4"} (current: {"node":"0.12.2","npm":"2.7.4"})
npm WARN engine har-validator#4.2.1: wanted: {"node":">=4"} (current: {"node":"0.12.2","npm":"2.7.4"})
npm WARN engine har-schema#1.0.5: wanted: {"node":">=4"} (current: {"node":"0.12.2","npm":"2.7.4"})
\
windows-build-tools#1.2.1 postinstall C:\Users\aidan\AppData\Roaming\npm\node_modules\windows-build-tools
node ./lib/index.js
Downloading BuildTools_Full.exe
[> ] 0.0% (0 B/s)
Downloading python-2.7.11.msi
[> ] 0.0% (0 B/s)
Downloaded python-2.7.11.msi. Saved to C:\Users\aidan\.windows-build-tools\python-2.7.11.msi.
Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!
Waiting for installers... -C:\Users\aidan\AppData\Roaming\npm\node_modules\windows-build-tools\lib\install\tailer.js:92
if (data.includes('Variable: IsInstalled = 1') || data.includes('Variabl
^
TypeError: undefined is not a function
at Tailer.handleData (C:\Users\aidan\AppData\Roaming\npm\node_modules\windows-build-tools\lib\install\tailer.js:92:16)
at null.<anonymous> (C:\Users\aidan\AppData\Roaming\npm\node_modules\windows-build-tools\lib\install\tailer.js:72:16)
at wrapper [as _onTimeout] (timers.js:265:14)
at Timer.listOnTimeout (timers.js:110:15)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--global" "--production" "windows-build-tools"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! code ELIFECYCL
npm ERR! windows-build-tools#1.2.1 postinstall: `node ./lib/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the windows-build-tools#1.2.1 postinstall script 'node ./lib/index.js'.
npm ERR! This is most likely a problem with the windows-build-tools package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./lib/index.js
npm ERR! You can get their info via:
npm ERR! npm owner ls windows-build-tools
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\aidan\Documents\discord bot\npm-debug.log
C:\Users\aidan\Documents\discord bot>
was what I got when I attempted to install build tools. I'm using Windows 10 Creators Update on a 64 bit machine.
Oh, yeah, and when I tried to install discord.js:
C:\Users\aidan\Documents\discord bot>npm install discord.js
npm WARN engine discord.js#11.1.0: wanted: {"node":">=6.0.0"} (current: {"node":"0.12.2","npm":"2.7.4"})
npm WARN peerDependencies The peer dependency bufferutil#^3.0.0 included from discord.js will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency erlpack#hammerandchisel/erlpack included from discord.js will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency node-opus#^0.2.5 included from discord.js will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency opusscript#^0.0.3 included from discord.js will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency sodium#^2.0.1 included from discord.js will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency libsodium-wrappers#^0.5.1 included from discord.js will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency uws#^0.14.1 included from discord.js will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN engine uws#0.14.5: wanted: {"node":">=4"} (current: {"node":"0.12.2","npm":"2.7.4"})
|
> bufferutil#3.0.0 install C:\Users\aidan\Documents\discord bot\node_modules\bufferutil
> prebuild-install || node-gyp rebuild
prebuild-install info begin Prebuild-install version 2.1.2
prebuild-install info looking for local prebuild # prebuilds\bufferutil-v3.0.0-node-v14-win32-ia32.tar.gz
prebuild-install WARN install EPERM, access 'C:\Users\aidan\AppData\Roaming\npm-cache'
C:\Users\aidan\Documents\discord bot\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (rebuild)
Traceback (most recent call last):
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 18, in <module>
sys.exit(gyp.script_main())
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 534, in script_main
return main(sys.argv[1:])
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 527, in main
return gyp_main(args)
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 503, in gyp_main
options.circular_check)
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 98, in Load
generator.CalculateVariables(default_variables, params)
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1867, in CalculateVariables
generator_flags.get('msvs_version', 'auto'))
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSVersion.py", line 402, in SelectVisualStudioVersion
versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
KeyError: '2015'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:343:16)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\aidan\Documents\discord bot\node_modules\bufferutil
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
> uws#0.14.5 install C:\Users\aidan\Documents\discord bot\node_modules\uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0
Thanks for your help!
-Aidan
I do not use Windows but found this blog from Treehouse.
http://blog.teamtreehouse.com/install-node-js-npm-windows
*Make sure you install node 1st, npm 2nd, and then any packages you want

Categories

Resources