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
Related
I am creating MSI installer for my electron application and I want to add a desktop shortcut icon on the time of installing the application. earlier I was using electron-wix-msi#2.2.0 which does not provide the feature. the desktop shortcut icon feature is added in version 3.0.0. I am getting an error when upgrading electron-wix-msi from version 2.2.0 to 3.0.0
npm install electron-wix-msi#3.0.0
> exe-icon-extractor#1.0.8 install F:\002_Installer_Upgrade\node_modules\exe-icon-extractor
> node-gyp rebuild
F:\002_Installer_Upgrade\node_modules\exe-icon-extractor>if not defined npm_config_node_gyp (node "C:\Users\xxxxxxxx\AppData\Roaming\nvm\v10.16.3\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\xxxxxxxxx\AppData\Roaming\nvm\v10.16.3\node_modules\npm\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.
module.cc
win_delay_load_hook.cc
..\src\module.cc(275): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [F:\002_Installer_Upgrade\node_modules\exe-icon-extractor\build\module.vcxproj]
..\src\module.cc(330): warning C4101: 'status' : unreferenced local variable [F:\002_Installer_Upgrade\node_modules\exe-icon-extractor\build\module.vcxproj]
LINK : fatal error LNK1117: syntax error in option 'LTCG:INCREMENTAL' [F:\002_Installer_Upgrade\node_modules\exe-icon-extractor\build\module.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\xxxxxxxxx\AppData\Roaming\nvm\v10.16.3\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\xxxxxxxxx\\AppData\\Roaming\\nvm\\v10.16.3\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd F:\002_Installer_Upgrade\node_modules\exe-icon-extractor
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN saveError ENOENT: no such file or directory, open 'F:\002_Installer_Upgrade\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'F:\002_Installer_Upgrade\package.json'
npm WARN 002_Installer_Upgrade No description
npm WARN 002_Installer_Upgrade No repository field.
npm WARN 002_Installer_Upgrade No README data
npm WARN 002_Installer_Upgrade No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: exe-icon-extractor#1.0.8 (node_modules\exe-icon-extractor):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: exe-icon-extractor#1.0.8 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ electron-wix-msi#3.0.0
updated 1 package and audited 77 packages in 18.198s
found 4 low severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
I am using node-gyp#3.8.0. is it the issue with node-gyp?
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
I tried everything but not able to install even a single npm module.
How should I fix this?
Microsoft Windows [Version 10.0.17134.590]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\Dell\Desktop\npmtestfolder>npm install bootstrap
ed25519#0.0.4 install C:\Users\Dell\node_modules\ed25519
node-gyp rebuild
C:\Users\Dell\node_modules\ed25519>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\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.
C:\Users\Dell\node_modules\ed25519\build\ed25519.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.D
efault.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on
disk.
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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Dell\node_modules\ed25519
gyp ERR! node -v v10.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\Dell\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Dell\package.json'
npm WARN bootstrap#4.3.1 requires a peer of jquery#1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap#4.3.1 requires a peer of popper.js#^1.14.7 but none is installed. You must install peer dependencies yourself.
npm WARN Dell No description
npm WARN Dell No repository field.
npm WARN Dell No README data
npm WARN Dell No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ed25519#0.0.4 (node_modules\ed25519):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ed25519#0.0.4 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ bootstrap#4.3.1
updated 1 package and audited 5449 packages in 13.153s
found 0 vulnerabilities
There are many reasons for your above mentioned error. Like your system don't get the proper path to buildsystem.
Your project's name also matters.
Your CMD's rights matters too like [Run as an Administrator].
Have you initialised your project with npm init? There is also written that package.json is not found. You are installing npm library on your windows root User's directory(here Dell is yours). Don't do that.
Make a separate directory and cd your dir by CMD with Administrator. Initialise your directory with npm init. Then try to install your respective libraries with (i.e npm i bootstrap).
This may help you. And if not, this are the best practices. You should follow, when you working on Node.
I'm setting up a Meanjs instance with a Yeoman generator. When I do 'sudo yo meanjs' everything works fine until it looks like it is trying to make a directory and it fails, any ideas on what is going on here?
SOLINK_MODULE(target) Release/kerberos.node: Finished
> bson#0.2.5 install /Users/xxx/Documents/mean/node_modules/connect-
mongo/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/bson.node
SOLINK_MODULE(target) Release/bson.node: Finished
npm ERR! Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15'
npm ERR! { [Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/xxx/.npm/uglify-js/2.4.15',
npm ERR! parent: 'grunt-contrib-uglify' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/xxx/Documents/mean
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path /Users/xxx/.npm/uglify-js/2.4.15
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15'
npm ERR! not ok code 0
That is a pretty common error.
Yeoman is running the following:
bower install & npm install
Bower install succeeded, however NPM install is failing because of user permissions. Just run:
sudo npm install
The ZenCoder's answer is spot on, but if you want to permanently fix this permissions error, you can follow the tutorial at: https://docs.npmjs.com/getting-started/fixing-npm-permissions
Since you're on a Mac, you could actually avoid npm permissions errors altogether by just installing node instead via homebrew:
brew install node (this will install npm too)
Homebrew installs programs to a directory that doesn't require sudo for write, so you can npm install -g <whatever> freely without it.
I want to install Mojito in Windows. I have MinGW and nodejs in Windows. But I am not able to install Mojito using npm install -g mojito. It gives the following error on installing in windows
npm WARN package.json connect#1.8.2 No README.md file found!
npm WARN engine connect#1.8.2: wanted: {"node":">= 0.4.1 < 0.7.0"} (current: {"node":"0.8.3","npm":"1.1.43"})
npm WARN engine express#2.5.2: wanted: {"node":">= 0.4.1 < 0.7.0"} (current: {"node":"0.8.3","npm":"1.1.43"})
npm ERR! error rolling back errno: 53,
npm ERR! error rolling back code: 'ENOTEMPTY',
npm ERR! notsup Unsupported
npm ERR! notsup Not compatible with your operating system or architecture: yui3#0.7.12
npm ERR! notsup Valid OS: darwin,linux
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: win32
npm ERR! notsup Actual Arch: ia32
npm ERR! System Windows_NT 6.1.7601
npm ERR! code EBADPLATFORM
npm ERR! stack Error: Unsupported
npm ERR! stack at checkPlatform (c:\Program Files (x86)\nodejs\node_modules\npm\lib\install.js:747:14)
npm ERR! stack at Array.1 (c:\Program Files (x86)\nodejs\node_modules\npm\node_modules\slide\lib\bind-actor.js:15:8)
npm ERR! stack at LOOP (c:\Program Files (x86)\nodejs\node_modules\npm\node_modules\slide\lib\chain.js:15:14)
npm ERR! stack at c:\Program Files (x86)\nodejs\node_modules\npm\node_modules\slide\lib\chain.js:18:7
npm ERR! stack at checkEngine (c:\Program Files (x86)\nodejs\node_modules\npm\lib\install.js:726:10)
npm ERR! stack at Array.0 (c:\Program Files (x86)\nodejs\node_modules\npm\node_modules\slide\lib\bind-actor.js:15:8)
npm ERR! stack at LOOP (c:\Program Files (x86)\nodejs\node_modules\npm\node_modules\slide\lib\chain.js:15:14)
npm ERR! stack at chain (c:\Program Files (x86)\nodejs\node_modules\npm\node_modules\slide\lib\chain.js:20:5)
npm ERR! stack at installOne_ (c:\Program Files (x86)\nodejs\node_modules\npm\lib\install.js:692:3)
npm ERR! stack at installOne (c:\Program Files (x86)\nodejs\node_modules\npm\lib\install.js:615:3)
npm http GET https://registry.npmjs.org/mkdirp/0.0.7
In Yahoo Developer Website it is mentioned clearly that Unix-based system is a Prerequisites, but is it possible to install it on windows by using cygwin or mingw.
It's an open issue, sorry about that.
Add yourself to https://github.com/yahoo/mojito/issues/264 to keep track of our progress.