Errors when installing discord.js - npm

I've been having some trouble with installing discord.js to my node_modules using windows powershell. I have checked multiple times and know I have the correct version of node, but every time I run npm install discord.js, it will go for awhile then gives me a bunch of errors like so
PS C:\Users\kevin\Desktop\Bot> npm install discord.js
(I removed the warnings and just left the errors that cause the installation not to work)
npm ERR! path C:\Users\kevin\Desktop\Bot\node_modules\async-limiter
npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall rename npm
ERR! enoent ENOENT: no such file or directory, rename
'C:\Users\kevin\Desktop\Bot\node_modules\async-limiter' ->
'C:\Users\kevin\Desktop\Bot\node_modules.async-limiter.DELETE' npm
ERR! enoent This is related to npm not being able to find a file. npm
ERR! enoent
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\kevin\AppData\Roaming\npm-cache_logs\2018-03-26T14_38_26_242Z-debug.log
(sorry if this didn't help)
I don't know what is wrong and can't seem to find anything online to help so hoping this might work, Thanks a lot.
(I also have node version 8.10.0)

Found this: https://github.com/npm/npm/issues/17444. There seem to be multiple workarounds there:
After npm got to the point that it was unusable, just before
reinstalling it, I had an idea: I opened task manager (I'm using
Windows) and found a bunch of instances of nodejs running. I was able
to shut them all down. Then when I ran npm install again, which at
this time was failing 100% of the time, and found that it was able to
execute without any problem.
Here is another one:
Workaround: Our standard workaround for this and all other NPM 5.x
problems is:
Delete package-lock.json and run NPM again.
Also a few users said it was caused by Malwarebytes Ransomware Protection, try disabling it and check if it fixes.

I had the same issue, what I had to do was open powershell on my desktop (not in a folder) and install npm to system32 (default location) then move the files to the folder I wanted them in. To get there, Navigate to the Windows System32 folder. Click the "Start" button and select "Computer." In the left-side window pane, locate and click on "Computer." Locate and click on the "(C:)" drive, locate and click on the "Windows" folder, locate and click on the "System32" folder. There will be a node_modules folder. Feel free to move or copy it, I recommend copying as its annoying to redo the instillation every time you want to add a file to it. (as in nmp i discord.js or npm i sql) Hope this works for you! :3 (feel free to message me if it didnt help for a more detailed answer, or walk through lol VampyMaria#4980 im also still learning node.js and discord.js so I cant really help with coding)

Related

What is the correct way of installing firebase-tools (a npm package) in NixOS/Nix?

I am watching this Udemy course on Firebase. The course is a bit dated, initially made maybe 6 years ago.
At some point the author indicates how to use firebase CLI, hence he indicates the command:
~/projects/chatlive]$ npm install -g firebase-tools
I added sudo to avoid permission problems:
~/projects/chatlive]$ sudo npm install -g firebase-tools
Unfortunately, this error message is retrieved:
npm WARN checkPermissions Missing write access to /nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules
npm ERR! code EROFS
npm ERR! syscall access
npm ERR! path /nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules
npm ERR! errno -30
npm ERR! rofs EROFS: read-only file system, access '/nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules'
npm ERR! rofs Often virtualized file systems, or other file systems
npm ERR! rofs that don't support symlinks, give this error.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-07-28T15_33_55_544Z-debug.log
I am using NixOS and this is my config file. Since the error message mentions the nix/store I thought it could be related.
Usually, I install things in NixOS changing my configuration.nix and doing sudo nixos-rebuild switch. But I thought it would not be necessary to do it considering npm was managing the installation.
Searching on Nix packages, I can see firebase-tools: link. Now, it seems that tweaking the config file is the way...
In situations like this, what is the best practice?
Should I force trying to install via npm (how?)? Should I go for a new generation of NixOS and a full system rebuild just because of this package?
Is there another possible path? Am I missing something?
Thanks.
If you just want to play around with firebase-tools in a development environment, create a shell.nix file in your working directory and add the following lines:
{ pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
nativeBuildInputs = [ pkgs.nodePackages.firebase-tools ];
}
Then run nix-shell to start a shell with firebase-tools included. This is considered best practice for local development environments, see https://nixos.wiki/wiki/Development_environment_with_nix-shell .
If you want to try out packages not in nixpkgs repo you should use npm and install a package locally (without -g ). See https://nixos.wiki/wiki/Node.js#Using_npm_install_-g_fails.

Errors when using "npm start" (in MacOS)

I have been trying for sometime already to just run "npm start" for an old app developed with EmberJs but I get several errors. I had tried the following:
Uninstall, cache clean, install Ember-cli
Remove the "node_modules" and run "npm install"
Updating ember-cli-babel
And some few others like updating / removing packages
I haven't open this project for around 3 years so I am pretty sure there are new updates that probably I need to follow but not sure what else to do after the list I just mentioned above.
I uploaded what I get when running "npm start".
Any guidance, help, or suggestion I would appreciate it! Thanks in advance!!
user#User-MacBook-Air app2 % npm start
> app#0.0.0 start /Users/user/Projects/app2
> ember serve
DEPRECATION: ember-cli-babel 5.x has been deprecated. Please upgrade to at least ember-cli-babel 6.6. Version 5.2.8 located: app -> ember-clean-tmp -> ember-cli-babel
ember-cli-htmlbars-inline-precompile v1.0.0 and above require the ember-cli-babel v6.7.1 or above. To use ember-cli-babel v5.x please downgrade ember-cli-htmlbars-inline-precompile to v0.3.
An error occurred in the constructor for ember-cli-htmlbars-inline-precompile at /Users/user/Projects/app2/node_modules/ember-cli-htmlbars-inline-precompile
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app#0.0.0 start: `ember serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app#0.0.0 start 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! /Users/user/.npm/_logs/2022-04-17T17_03_00_039Z-debug.log
To make your life easier and get your app going faster, I’d suggest trying to stay in the Babel 5.x world and see how few dependencies you can update to start with. So I’d probably start by heading the suggestion in the warning and downgrade
ember-cli-htmlbars-inline-precompile v1.0.0 and above require the
ember-cli-babel v6.7.1 or above. To use ember-cli-babel v5.x please
downgrade ember-cli-htmlbars-inline-precompile to v0.3.
That may still mean you but other errors, but ideally you’d stick with the same ember, ember cli and ember data (and all associated dependencies) instead of trying to do a large and possibly time-consuming upgrade
Also, might be worth introducing a lock file (either using Yarn 1 or a Node 6 lock file if your system can run with it) so you don’t hit this issue in the future.

npm or yarn test fails with "npm ERR! enoent spawn bash ENOENT"

I am trying to follow a tutorial on how to fork Compound (https://medium.com/compound-finance/a-walkthrough-of-contributing-to-the-compound-protocol-9450cbe2133a). I want to add a new token. But in order to do that, I need to first be able to get the app to pass all tests.
The problem is that I can't get the tests to run in the first place. According to the tutorial, I simply need to type yarn test to run the tests. However, when I try to do this, I get error messages that seem to imply that it cannot find the path to the test file. For example:
'.\script\test' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command." >
or
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\tombl\Documents\Code\compound-protocol
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent>
After investigating some, I discovered that it is trying to run a script in package.json called "test".
The script looks like this: "test": "./script/test",
At first, I got a response saying that "." is not a recognized command. I then tried to put the entire pathname in it so that it wouldn't have a period in it. So I edited package.json to say "test": "C:/Users/tombl/Documents/Code/compound-protocol/script/test",
That didn't work. Next, I tried to edit the environment variables in Windows so that CMD would recognize the folder (I'm using a terminal from within Visual Studio Code). That didn't work either.
After reading some other stack exchange answers, I followed the advice here (npm - The system cannot find the path specified) and typed npm config set script-shell bash. This also didn't work.
In addition, I tried editing package.json so that there is a second set of quotes in the path, like this: "test": "'C:/Users/tombl/Documents/Code/compound-protocol/script/test'", But it still didn't work.
Oh, and I tried using npm test instead of yarn test.
At this point, I have no idea what to try next.
I can see very clearly in file manager that the "test" file is there and that the path I've stated is correct. I can even open up the test file and see the code inside of it. But I can't get the terminal to run it. It just says that it isn't there.
One clue I do have is that it stops at the folder "compound-protocol". So it either doesn't recognize the folder compound-protocol at all or it doesn't recognize that the script folder is inside of it.
I've wondered if maybe the hyphen in "compound-protocol" is causing the problem, but the only advice I've gotten on how to fix that is to put the whole path in quotes, which I've already tried.
I've even tried navigating to the script folder within the terminal and running the test from there. While it does let me navigate into the script folder, trying to run the test produces a > Program 'test' failed to run: No application is associated with the specified file for this operationAt line:1 char:1. > error message.
Does anyone know how I might go about fixing this?
have you tried to use yarn install first? Also you need to use Node.js version 12 with that repository. NVM is a great tool to quickly switch between versions of Node on the command line. https://nvm.sh

JFrog private registry fails to npm install

I'm having issues with JFrog NPM private repositories.
In our CI we configure the npm private registry and then do npm install like this:
- npm_private_registry https://DOMAIN.jfrog.io/DOMAIN/api/npm/npm-virtual/ $TOKEN
- npm install
This code works perfectly fine when we use the node:12.13.1 Docker image.
Our problem is that as soon as we change the image to a newer one, let's say node:12.16.1 then the npm install command fails.
We then get the following errors:
$ npm install
(wd=/builds/DOMAIN/APP)
npm WARN tar ENOENT: no such file or directory, open '/builds/DOMAIN/APP/node_modules/.staging/react-icons-921e2ffa/go/package.json'
npm WARN tar ENOENT: no such file or directory, open '/builds/DOMAIN/APP/node_modules/.staging/intl-58a6f707/locale-data/jsonp/gsw-FR.js'
...
...
...
npm ERR! Response timeout while trying to fetch https://DOMAIN.jfrog.io/DOMAIN/api/npm/npm-virtual/next (over 30000ms)
We tried various approaches already, but haven't been able to figure anything out just yet.
Does anyone have an idea where to start?
The issue seems quite generic. How is it possible to get timeouts on one version of the node image and no issues on another?
Thank you!
Seems like this link https://github.com/npm/cli/issues/1151 offers some explanation. The timeout got hardcoded down to 30000 ms in npm 16.4.0 via npm-registry-fetch. This has now been reverted to not timeout again https://github.com/npm/npm-registry-fetch/commit/fc5d94c39ca218d78df77249ab3a6bf1d9ed9db1. This fix is in 6.14.5 of npm https://github.com/npm/cli/releases/tag/v6.14.5.
In terms of default npm with node versions this means, releases 12.16.2 and 12.16.3 of node contain this problem via npm 6.14.4.

`npx create-nuxt-app <project name>` not working: MacOSX

I use a MacOS High Sierra. For anyone with experience with Nuxt.js, the command
npx create-nuxt-app <project-name> has not worked for me at all!
I consistently come across errors from npm saying I need to update my dependencies. I first tried updating each dependency using npm outdated (check for outdated packages) and
npm update <pkg name>. This did not work.
I also uninstalled and reinstalled node and npm and tired the above (and below processes). Still did not work.
No matter what I do, the Terminal keeps saying my core-js needed to be updated so I did that (I tried both npm i core-js and npm i core-js ) - they did not work.
To update the npm dependencies, I used the command npm install -g npm-check-updates followed by ncu -u, and then tried both npm update and npm install. Nothing has worked so far.
Lastly, I've tried creating a package.json since npm complained that I had no package.json so I created one using npm init and following the instructions to commit the file(s) created. Still, nothing after running npx create-nuxt-app <project-name>.
What is happening? Has anyone experienced this issue? I really love Nuxt.js and I've tried this for an entire day but I'm giving up on using NuxtJS.
EDIT: I managed to solve part of my problem by creating a Nuxt app from scratch. However, I get the following errors:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nuxt-app#2.11.0 dev:nuxt
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nuxt-app#2.11.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
There are many solution based on your problem. Sharing a simple one, if you have npm installed then execute below command to install npx:
npm install -g npx
you can find all others solution from here
and My suggestions are:
As i saw your description, package.json not created. definitely something wrong for creation of the project, it may cause the read write problem of files into disk. or you have created the project into subdirectory but trying to run the project from parent directory. initially many peoples doing this practice to create scratch project. by the way create a separate directory and then run npx create-nuxt-app. no need to give project name and pass the phase when prompt to create project in same directory. so then i think problem will solved
I fixed the issue! It worked when I created a new directory altogether (the next day) and reran npx create-nuxt-app <new-app>. Get started, build for production, and tests ran perfectly.