How to install npm package from downloaded folder - javascript

I used to install an npm project from github by doing
git clone http...my_project
npm install my_project
Instead of copying the contents of my_project to my local node_modules folder, it actually created a symlink from node_modules/my_project to my_project, then I could modify everything on my git cloned folder and it'd be on my project.
I believe this behavior changed in newer versions because it won't create the symlink anymore. It just copies the folder to node_modules
Is there a way to do it again?

Try this:
npm install "file:your/module/path" --save

Instead of running:
git clone http...my_project
npm install my_project
Use this:
git clone http...my_project
cd my_project
npm install

Related

module npm file doesn't appear to me

I am trying to follow with pluralsight tutorial and he wrote npm install on the terminal, then a file called npm module is installed on the folder he specified. when I try to install npm this appears to me in the terminal, and the directory which Im trying to install npm on it contains only one document called package-lock.json enter image description here
npm install uses the package.json to install the necessary packages
I can see when you ls, there's no package.json in the directory, just the package-lock which is created where ever you run npm install
Make sure you run the npm install from the same directory the package.json in contained in
the problem is solved, I think that I download the web-dev-starter folder twice by mistake.

React can not find module

After I create my react project with
npx create-react-app
my-app I run
npm start
and get this error as you can see below in the image
node version: 12.16.1
npm version: 6.13.4
enter image description here
I will be grateful if you show me a solution!
and this is my package.js file
https://imgur.com/v8yeKrR
Try removing your node_modules and package-lock.json.
Then reinstall npm i
then start npm start
These kind of problems could be happening when clashing react modules. Delete node_module folder and package-lock.json file. Then run again npm install and npm start.
Use yarn create react-app my-app , cd my-app ,npm start .Now download all the dependencies form npm or yarn. It will work.

"npm install <github url>" Downloading from NPM instead of GitHub

So I am trying to install a package from GitHub, but for some reason npm install is pulling a different package (which has the same name) from NPM, instead of GitHub.
When I run npm install git+https://github.com/wojtekmaj/react-daterange-picker, it for some reason installs the package https://github.com/onefinestay/react-daterange-picker. This happens even if I manually insert the GitHub package url into my package.json dependancies, and then run npm install.
I have even tried deleting all my cache, and even deleting /node_modules/ and package-lock.json and reinstalling via the command rm -rf node_modules package-lock.json && npm install.
Any ideas why npm install is pulling from NPM instead of GitHub?
If I understand you correctly you do rm -rf node_modules package-lock.json && npm install before trying your command. But this will install everything according to package.json and recreate package-lock.json. So when you do your modified command it won't work.
I think the best way is to:
rm -rf package-lock.json node_modules
Modify your package.json to use the correct git+https link
npm install

Installed package through npm but it does not show in folder

I was trying to install jquery through npm but after using following command:
npm install jquery
I opened the destination folder and the folder was empty.
(I copied the following text from cmd)
> C:\Users\mandar\Desktop\Mady>npm install jquery
C:\Users\mandar
`-- jquery#3.1.1
> npm WARN enoent ENOENT: no such file or directory, open
> 'C:\Users\mandar\package.json'
npm WARN mandar No description
npm WARN mandar No repository field.
npm WARN mandar No README data
npm WARN mandar No license field.
What am I doing wrong? Please help me
You don't have a package.json. Create a one and then try to install jQuery. And instead use
npm install jquery --save
command to save the jquery dependency in the package.json file
You can do it manually creating package.json or by
npm init and passing the steps
create package.json file manually or through cmd by command npm init or npm install jquery --save
As Suren Srapyan mentioned, in order to solve the problem, you need to create a package.json file, which describes the project you're working on.
The easiest way to create a package.json file is to run npm init - this will invoke a terminal-based walkthrough of creating the package.json file.

How to install a local package from a local source?

I use this git repo: https://github.com/kudago/smart-app-banner
I downloaded it with git clone https://github.com/kudago/smart-app-banner.
Then I tried to install it from its parent dir with:
npm install --save smart-app-banner
This always installs the source from the github repo instead of from the local source.
How do I get the source being install from the local copy instead of from github?
npm install /path
it is as simple as that
If you run npm install without any arguments, it tries to install the current folder.
Go to that folder and type npm Install
or
Just put that downloaded File in Node_modules folder of your project.

Categories

Resources