Error: Cannot find module '../lib/npm.js' - windows

Brief context: I was using an older version of node but decided to upgrade node so I downloaded the .msi and installed it. Installation went normally, however npm stopped working and I get this error
Here's a screenshot of PATH
How do I solve this problem?

I have also encountered this problem exactly likes yours on my server(CentOS 6.8), and I solved it finally.
Though the OS are different, but hope it's helpful to you.
Here is my solution:
Delete the directory node_modules, and uninstall node and npm, then reinstall them.
Then you may fix the issue.

Related

My vsc code disappeared and I have no idea why or where it's gone

I was working with discord.js last night and I ran a few commands in the terminal. The last command I wrote caused the name of the file at the top of the screen to be crossed out and turn red and I followed the path to where the file was and it was gone. I've checked the recycling bin and nothing was there. The file has left no traces and the project is gone. Is there any way that I can get the code back?
The commands I ran were -
npm update,
npm audit,
npm audit fix (the one that caused the file to disappear)
My file was also within the node_modules folder which probably explains why it disappeared when I ran those.
Any help is appreciated, thanks.
Yes, apparently this happens sometimes, especially when there is update on restart (see here https://github.com/microsoft/vscode/issues/52855). For some reason the software is moved to
C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\_
where <user> is your username.
If you start from there it goes as always. I didn't try any move or rename, just reinstalled the last version and everything went back to normal. This is first time happening to me, and according to most reports it doesn't happen often enough to be a problem, however a few users report it to have happened tens of time, that I understand being an annoyance.
If the file that got removed was inside the node_modules folder there's no problem. You can just remove the node_modules folder and run npm install . That will fix the problem.
If there is not package.json file in your project, you can still remove the node_modules folder but then you need to install every dependency manually like this: npm install <module_name>.

Metasploit Framework .go module can't be loaded

This is my first post, so I might get the format wrong.. Anyway, after searching for a solution online (which I could not find), I resorted to asking here.
Upon launching my msfconsole a few days ago, I started getting all of these warnings/errors which were not showing before.
$ sudo msfconsole
[!] The following modules could not be loaded!..\
[!] /usr/share/metasploit-framework/modules/auxiliary/scanner/msmail/host_id.go
[!] /usr/share/metasploit-framework/modules/auxiliary/scanner/msmail/exchange_enum.go
[!] /usr/share/metasploit-framework/modules/auxiliary/scanner/msmail/onprem_enum.go
[!] Please see /root/.msf4/logs/framework.log for details.
metasploit v6.0.31-dev
I could not find any solution to this .go module loading issue. I might have screwed something over some time ago, but my last VM snapshot is just too far away.
Thank you all for your help!
just install go in your kali:
sudo apt install gccgo-go
I also got the same problem.
But, since the error message clearly ask me to check error log file, actually there is clear solution too.
[!] Please see /root/.msf4/logs/framework.log for details.
[09/05/2021 22:29:56] [e(0)] core: /usr/share/metasploit-framework/modules/auxiliary/scanner/msmail/onprem_enum.go failed to load - LoadError Failed to execute external Go module. Please ensure you have Go installed on your environment.
And after the Go installation, the problem is solved.
Therefore, the solutions is that you just need to install Go on your machine.

Why can't I run yarn start?

For a few days I have been getting these messages:
*> yarn run v1.21.1 $ react-scripts start
There might be a problem with the project dependency tree. It is
likely not a bug in Create React App, but something you need to fix
locally.
The react-scripts package provided by Create React App requires a
dependency:
"eslint": "^6.6.0"
Don't try to install it manually: your package manager does it
automatically. However, a different version of eslint was detected
higher up in the tree:
/home/sol/Repository/node_modules/eslint (version: 6.3.0)
Manually installing incompatible versions is known to cause
hard-to-debug issues.
If you would prefer to ignore this check, add
SKIP_PREFLIGHT_CHECK=true to an .env file in your project. That will
permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact
order:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove "eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem. If this has
not helped, there are a few other things you can try:
If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
Check if /home/sol/Repository/node_modules/eslint is outside your project directory.
For example, you might have accidentally installed something in your home folder.
Try running npm ls eslint in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed eslint.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file
in your project. That would permanently disable this preflight check
in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-)
We hope you find them helpful!
error Command failed with exit code 1. info Visit
https://yarnpkg.com/en/docs/cli/run for documentation about this
command.*
I tried everything above, but nothing helps and I'm really upset about this situation because I can't get my code to work.
Can someone help me with easy instructions because I don't have time anymore to try and find a solution to the problem.
I could not solve the problem:
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"eslint": "^6.6.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of eslint was detected higher up in the tree:
/Users/elvestrindade/node_modules/eslint (version: 6.2.2)

Yarn: How to link acorn using boltpkg - symlink error

My team has a monorepo where we are using bolt to manage dependencies and linking. I was trying to get the dev environment up and running on my local Windows machine but had issues install/link acorn. What I did was clone the repo, then $ bolt to install dependencies. As you can see, it showed error linking dependencies and complained about acorn.ps1 not being a symlink. I've done some research but none of the solutions I found, such as including --non-bin-links or running as admin, worked for me. I'd appreciate if you could provide some insights on this.
Windows: 10;
Yarn: 1.13.0;
Bolt: 0.22.6 - tried 0.22.4 as well but did not work;
Ok I found the solution to this issue.
acorn is not a dependency for my project, but it is one for yarn itself, as I searched for it and it only appears in yarn.lock. Meaning there's definitely something weird with my current version of Yarn, 1.13.0. So I downgraded it to 1.12.3 and according to the official documentation, installed bolt as a local package instead of a global one. It solved this issue.

The Command "grunt" exited with code 3 error when building project

I am unfamiliar with Grunt and I tried to follow steps to install it. I am getting this error and I have tried for a week to get it to work. Can anyone please help me. I am an undergrad student and don't have that much know how with it. I followed the installation instructions on the website. and know its a task error. but after that I cant find any working solutions.
Apparently the error is inside the js file.
npm rebuild node-sass
This one helped me.

Resources