npm install result in an incomplete module, but yarn install is successful, why they behave differently? - npm

I tried npm install and npm install --no-optional for my forked repository, and it was not installed completely: git+https://github.com/marsonmao/react-sketch#v0.4.104 (link).
After using npm install, only part of the repository was installed: there are only /node_modules and .eslintrc, karma.config.js, README.md...etc in MyProject/node_modules/react-sketch, but no /lib and /src...etc.
Then I tried yarn install and it was successful, every file in the repository was installed.
So why npm failed however yarn succeeded?
npm version: 5.5.1, yarn version: 1.3.2

Related

Errors when doing npm install

I've already installed Node.js in my machine. When I try npm install, the installation does not properly work for me. I get the following on my console:
Installed node version 14.15.1
Installed npm version 6.14.8
Installed angular cli version 11.2.3
And then some errors pop up. Here's a screenshot of my console:
Any of the following methods might be useful for you:
Method 1: Clean cache & then perform an installation
npm cache clean --force
npm install
Method 2: Exclude package-lock.json file and perform an installation
npm install --no-package-lock
Method 3: Manually delete node_modules and package-lock.json file and then perform an installation
npm install

Gulp doesn't work after reinstalling Windows

Upon reinstalling Windows 10 (and Node.js), the gulp command isn't found. I ran it from my root folder containing package.json and the node_modules folder. I tried npm install gulp, and also npm install: gulp command still not found. I'm a bit puzzled.
Any idea?
do you re install node and npm again? when you re install node try with npm install -g gulp
npm install -g gulp will install gulp globally, so that you can use it as a command.
A better way to do it, is to use npm install gulp (without the -g) to install it into each local project, and fire it off using npm start scripts in each project's package.json.

npm does not install new package after modifying package.json

I have a web application with some packages defined in package.json after I run npm install all dependencies are resolved. However when I add some packages after that to package.json and run npm install again nothing happens. I did the work around by typing npm install --save lodash and it downloaded the dependency and updated packages.json. It works, but let's imagine the scenario when I want to add 10 or more packages. Then it would be easier for me to just add them to package.json and run npm install but this does not work :/. So what would be the solution for the problem off adding more packages after initial npm install?
Node version: v8.1.3
npm version: 5.03
Operating System: Windows 10 Pro

Failure to install packages after setting yarn to package manager

Im trying to setup a new project with angular cli and have set my package manger like this:
ng set --global packageManager=yarn
However, when I try to create a new angular project with cli, I get this
Installing packages for tooling via yarn.
'yarn' is not recognized as an internal or external command,
operable program or batch file.
Package install failed, see above.
Package install failed, see above.
So then I start looking to see if I have yarn even installed and I do this:
D:\devsrc>npm list -g --depth=0
and get this:
C:\Users\me\AppData\Roaming\npm
+-- #angular/cli#1.3.1
+-- angular-cli#1.0.0-beta.28.3
`-- typescript#2.2.2
npm ERR! peer dep missing: rxjs#^5.0.1, required by #angular/core#2.4.10
npm ERR! extraneous: tsickle#0.2.5 C:\Users\
How can I have 2 different versions of angular cli installed?
How can I clean this up and get Yarn installed?
So first thing, you are getting 'yarn' is not recognized as an internal or external command error is because you do not have yarn globally installed run
npm install yarn -g to fix that
Second you have two #angular/cli#1.3.1 and angular-cli#1.0.0-beta.28.3 packages is because the angular cli package name has being changed since version 1.0.0-beta.28.3. Before it was angular-cli now it is #angular/cli so just uninstall the old one uninstall angular-cli -g. After that you might need to reinstall the latest one npm install #angular/cli -g

IntelliJ cant see npm plugins

My IntelliJ is not seeing my karma plugins:
WARN [plugin]: Cannot find plugin "karma-ng-extjs-scenario".
Did you forget to install it ?
npm install karma-ng-extjs-scenario --save-dev
WARN [plugin]: Cannot find plugin "karma-jasmine".
Did you forget to install it ?
npm install karma-jasmine --save-dev
WARN [plugin]: Cannot find plugin "karma-chrome-launcher".
Did you forget to install it ?
npm install karma-chrome-launcher --save-dev
WARN [plugin]: Cannot find plugin "karma-firefox-launcher".
Did you forget to install it ?
npm install karma-firefox-launcher --save-dev
I believe it is because i was following a tutorial that told me to install them globally.
But then i realised that i wanted to install them locally and save to the package.json.
I try again to install locally and it doesnt fix it:
$ npm install karma-jasmine --save-dev
npm WARN package.json karma-ie-launcher#0.1.5 No README data
info trying registry request attempt 1 at 21:06:11
http GET https://registry.npmjs.org/karma-jasmine
http 304 https://registry.npmjs.org/karma-jasmine
karma-jasmine#0.1.5 ../../../node_modules/karma-jasmine
I can however run karma from within my project from the command line and the plugins exist in the npm modules directory.
Is there a way to fix this or do i need to reinstall the packages from scratch? If so, what is the easiest way of doing that?
the --link flag linked the global install into the local directory.
npm install karma-jasmine --save-dev --link