Understanding on installing packages using npm - npm

I just started to use npm command while learning angularJS2. I get errors while trying to install packages using npm command, for instance when i try to run this command
npm install json-typescript-mapper --save
to install json to typescript mapper package, i am not able to install it. am i missing something, should i change the registry? my current registry is http://registry.npmjs.org/ should i have to change the registry inorder to install the package
ERROR
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
and after that when i try to import the package, i get an error stating the package not found because the package was not added

Related

Uninstalling quasar-cli via npm not working?

I was working on a Quasar project on my windows machine and out of blue it is saying quasar is not recognized as an internal or external command.
I tried to uninstall quasar-cli with the command npm uninstall -g quasar-cli but it seems it is not working. npm list -g --depth=0 command tells me that I still have the quasar-cli.
C:\Users\nitin>npm uninstall -g quasar-cli
up to date in 0.028s
C:\Users\nitin>npm list -g --depth=0
C:\Users\nitin\AppData\Roaming\npm
+-- #quasar/cli#1.1.0
+-- cordova#9.0.0
+-- nodemon#2.0.4
`-- vue-cli#2.9.6
I am also not able to install it again as it gives the following errors
C:\Users\nitin>npm install -g quasar-cli
npm WARN deprecated #babel/preset-stage-2#7.0.0-beta.54: � We've deprecated any official stage presets in favor of users explicitly opt-ing into the proposals they want to use versus any perceived convenience. You can also check https://github.com/babel/babel/issues/7770 for more information.
npm WARN deprecated chokidar#2.0.4: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated #babel/preset-stage-3#7.0.0-beta.54: � We've deprecated any official stage presets in favor of users explicitly opt-ing into the proposals they want to use versus any perceived convenience. You can also check https://github.com/babel/babel/issues/7770 for more information.
npm WARN deprecated core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated joi#11.4.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated topo#2.0.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated hoek#4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN rollback Rolling back is-descriptor#1.0.2 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\nitin\AppData\Roaming\npm\node_modules\quasar-cli\node_modules\define-property\node_modules'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.2 (node_modules\quasar-cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN notsup Unsupported engine for watchpack-chokidar2#2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"12.17.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2#2.0.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.1.2 (node_modules\quasar-cli\node_modules\watchpack\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN ajv-keywords#3.5.1 requires a peer of ajv#^6.9.1 but none is installed. You must install peer dependencies yourself.
npm ERR! code EEXIST
npm ERR! path C:\Users\nitin\AppData\Roaming\npm\node_modules\quasar-cli\bin\quasar
npm ERR! dest C:\Users\nitin\AppData\Roaming\npm\quasar
npm ERR! EEXIST: file already exists, cmd shim 'C:\Users\nitin\AppData\Roaming\npm\node_modules\quasar-cli\bin\quasar' -> 'C:\Users\nitin\AppData\Roaming\npm\quasar'
npm ERR! File exists: C:\Users\nitin\AppData\Roaming\npm\quasar
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\nitin\AppData\Roaming\npm-cache\_logs\2020-07-19T04_24_31_029Z-debug.log
Can you please suggest where am I going wrong. I am new with npm and JS in general so please correct if I am missing something.
I've recently performed a manual delete for a similar issue I was facing, opting instead to use the rimraf package to delete a module from the npm root directory where global packages are installed.
Install rimraf using:
npm install rimraf -g
Navigate to the root folder of where the global packages are installed. Path to this can be found using:
npm root -g
Once you've cd' into the root folder perform the delete on the quasar-cli module using:
rimraf <name of folder>
Note:
<name of folder> is the name of the folder quasar-cli is contained within. Perform a dir/w to list the folder in the directory to check the exact name of the folder to insert in the command above.
The rimraf package is a cross-platform equivalent of what I use in the bash terminal rm -rf to recursively delete files and folders. You can see this in action on windows via: https://www.youtube.com/watch?v=qPCK6mWeqsk
Check that the removal of the package as per your previous command:
npm list -g --depth=0
Hope that helps
I ultimately had to delete the node-modules folder from
C:\Users\{user}\AppData\Roaming\npm\node_modules
as I was having issue not only with quasar but also with vue and everything else.
vue --version also wasn't working.
I deleted the node-modules folder from the above path and also from my project folder and then re-installed them using npm install -g command. This command needs to be run in your project folder where you have your package.json file.
Else you can individually install(globally using the -g appended to the command) each component of your need.
Restart the command prompt after installing the packages.
Don't forget to keep a list of all the packages you have using
npm list -g --depth=0`
Try this
npm uninstall -g #quasar/cli

Cannot find module 'webpack-cli/bin/config-yargs', cannot find module 'webpack-cli'

I have tried nearly all solutions however nothing has worked for me. i cloned a repo from a friend and tried to run the client directory. When i try run client, i get the error:
Cannot find module 'webpack-cli/bin/config-yargs'
Cannot find module 'webpack-cli'
Once i cloned the project i did npm install (as it said in the readME) but when i tried to run the client i would run into this problem:
solutions i tried:
npm install -g vue-cli
npm install --save-dev webpack
npm install --save-dev webpack-cli
i tried 'webpack --version' it will tell me i am missing something and if i want to install it. i click yes and i get the following error:
Installing 'webpack-cli' (running 'npm install -D webpack-cli')...
npm WARN ajv-keywords#3.4.1 requires a peer of ajv#^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware#3.4.0 requires a peer of webpack#^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-server#3.1.11 requires a peer of webpack#^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-cli#3.3.11 requires a peer of webpack#4.x.x but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
webpack-cli#3.3.11
updated 1 package and audited 12959 packages in 13.437s
24 packages are looking for funding
run npm fund for details
found 33 vulnerabilities (22 low, 7 moderate, 4 high)
run npm audit fix to fix them, or npm audit for details
Error: Cannot find module 'webpack-cli'
UPDATE:
My colleague updated some of the dependencies by GitHub bot and i pulled the repo. That seemed to do the trick

Any way to avoid fsevents warnings?

Trying to get into react, using npm and such, and I often get these types of warnings:
> npm install axios redux react-redux redux-thunk react-router-dom validator redux-form
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.8 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.8 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.0.6 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.0.6: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ redux-thunk#2.3.0
+ validator#10.11.0
+ axios#0.18.0
+ react-router-dom#5.0.0
+ redux#4.0.1
+ react-redux#7.0.2
+ redux-form#8.2.0
added 30 packages from 100 contributors and audited 878734 packages in 23.247s
found 0 vulnerabilities
Apparently I can just ignore them, but I'm just curious if there's a way to not get these warnings? Configure npm somehow? Adding something to package.json? A flag somewhere?
You can silence the npm WARN upon installation by specifying what types of errors you want to see.
You can run npm --logevel=error install.
By using --loglevel=error you will only see npm ERROR and ignore any WARN
It's a warning, due to the operating system. fsevents run on mac os environment but in windows, it works as optional dependencies that are the reason behind your warning after all its not an error.
you can use https://github.com/paulmillr/chokidar instead of fsevents.
The problem relates to the "shrinkwrap" or package-lock.json which gets persisted after every package manager execution. Subsequent attempts keep failing as this file is referenced instead of package.json.
Adding these options to the npm install command should allow packages to install again.
--no-optional argument will prevent optional dependencies from being installed.
--no-shrinkwrap argument, which will ignore an available package lock or
shrinkwrap file and use the package.json instead
.
--no-package-lock argument will prevent npm from creating a package-lock.json file.
The complete command looks like this:
npm install --no-optional --no-shrinkwrap --no-package-lock
you can look into following answer npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.0.14

Error in adding vuetify on a project

I have created a vue-cli project.
And I tried to add vuetify but I couldn't do it
I've run: npm install vuetify --save
A error came out on terminal:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.3 (node_modules/sane/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
When I try to import vuetify on main.js it says that can't find the module.
Does anyone know how to fix/install it?
You could try using yarn, I find it sometimes performs better
install yarn
npm i -g yarn
Then install dependencies (run in your package.json file folder)
yarn
You can also do a clean install by first removing the nodes_modules folder, and then install without optional dependencies npm install --no-optional

npm packages added after uninstall dependencies

Why after calling npm uninstall I see message added packages?
For example:
$ npm uninstall -S redux-devtools-dock-monitor redux-devtools-log-monitor redux-devtools
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 115 packages and removed 22 packages in 20.589s
For that specific example at least here is some removed packages. Sometimes it just shows only added <n> packages message.
Could someone clarify it?
UPD: I did a little test from scratch but everything works as I expected when uninstall something. But I see such messages like above in question really often.