Updating npm on windows - windows

I am currently on npm version 1.2.32. When I run the following:
npm update npm -g
I get the following output:
npm WARN package.json cheerio-select#0.0.3 No repository field.
npm WARN package.json cli-table#0.2.0 No repository field.
npm WARN package.json assert-plus#0.1.2 No repository field.
npm WARN package.json ctype#0.5.2 No repository field.
Then when I check version afterwards using npm -v, it hasn't updated. Is there something else I need to do?

Found the Fancy Windows Install in the docs:
Download zip from http://nodejs.org/dist/npm/
Unpack in the same folder where node.exe lives

Related

Cant run cypress using UI

I can run my scripts using editor in headless mode but scripts are failing when tried to run using cypress UI
Getting error
From Node.js Internals:Error: socket hang upat connResetException (node:internal/errors:690:15)at Socket.socketOnEnd (node:_http_client:471:24)at Socket.emit (node:events:406:36)at endReadableNT (node:internal/streams/readable:1331:13)at processTicksAndRejections (node:internal/process/task_queues:83:22)
Try to upgrade cypress version from 9.4.1. to 10.1.0 but again getting error
PS C:\Users\hshah\cypress> npm install --save-dev cypress#10.0.3
npm ERR! must provide string spec
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hshah\AppData\Local\npm-cache_logs\2022-06-20T05_10_05_825Z-debug.log
PS C:\Users\hshah\cypress>
Not sure what can be the reason?
Remove your package-lock.json file and node_modules folder.
In your package.json, change the cypress version to 10.1.0
Run the command npm cache clean --force
Then run the command npm install. This will install all the dependencies listed in your package.json file.

How solve missing package.json

Hello my problem is when I try to remove any npm package o install my terminal show this warning
npm WARN saveError ENOENT: no such file or directory, open '/Users/liantonypozo/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/liantonypozo/package.json'
some way to fix that without affecting the packages I have installed ?
capture
How are you uninstalling? Do it via npm uninstall packageName. When you have problems, also try deleting node_modules and package-lock.json then doing npm install.
From your screenshot, your list of packages are the global packages, because you ran npm list with the -g flag. You need to do the same with the uninstall command - npm uninstall -g bower - if you want to delete one of those globally installed packages.

Install NPM package if not installed using shell script

I want to write a shell script to install NPM package if not already installed.
I can use the command npm info <package-name> version to get information about the package. It gives me the version if it is already there
2.0.0
If it is not there it gives an error.
npm ERR! code E404
npm ERR! 404 Not found :<package>
npm ERR! 404
npm ERR! 404 '<package>' is not in the npm registry.
How can I use this result in a conditional block to do some task depending on it?
I think you're over-complicating things. npm-install already checks if the module is installed and just ignores it if it's already there, so all you need to do is call it:
$ npm install mymodule#2.0.0

Error installing Composer on Ubuntu

I am trying to install Composer on Ubuntu 14.04. I was able to install the prerequisites. When installing composer, I get the following error. How to fix it?
npm install -g composer-cli
npm WARN deprecated fs-promise#1.0.0: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated crypto#0.0.3: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
npm WARN deprecated node-uuid#1.4.8: Use uuid module instead
npm WARN deprecated jade#1.11.0: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated transformers#2.1.0: Deprecated, use jstransformer
npm WARN deprecated nodemailer#2.7.2: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
/root/.nvm/versions/node/v6.11.2/bin/composer -> /root/.nvm/versions/node/v6.11.2/lib/node_modules/composer-cli/cli.js
> hashtable#2.0.2 install /root/.nvm/versions/node/v6.11.2/lib/node_modules/composer-cli/node_modules/hashtable
> node-gyp configure build
sh: 1: node-gyp: Permission denied
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.2 (node_modules/composer-cli/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"})
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! hashtable#2.0.2 install: `node-gyp configure build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the hashtable#2.0.2 install 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! /root/.npm/_logs/2017-08-22T16_31_22_412Z-debug.log
So firstly you should not install Hyperledger Composer as 'root'. You need to read the docs here before you proceed https://hyperledger.github.io/composer/installing/development-tools.html
So fundamentally this is an npm issue (in that it causes problems for npm, when you npm install as 'root' or 'sudo' privileges for installing modules).
I suggest you create a non-root user in your Ubuntu system. Then log in as that user. Then install the pre-reqs using the supplied prereqs-ubuntu.sh script from the link above. Then follow the instructions, installing as your non-privileged user.
Normal route to fixing a non-root install npm issue, is one of these shown here https://docs.npmjs.com/getting-started/fixing-npm-permissions
When you install composer modules globally (eg. composer-cli) you should install using a designated, non-root user as mentioned. If there are issues (eg, on Ubuntu with permissions to write/update node directories located in system directories like /usr/local) - one solution (but see link earlier) is perform the npm install to a directory you have access to - rather than resort to root or superuser access, as this is not good practice. Here is what to do to set the npm prefix to a given directory, ...
"npm config set prefix /home/myuser/"
In this case, global binaries are placed in /home/myuser/bin which is in your PATH, and the modules are placed in /home/myuser/lib ...

Cannot run npm install browserify

I try to run npm install browserify both locally and globally (-g)
but I always got the follow errors
npm ERR! peerinvalid The package bn.js does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer miller-rabin#1.1.2 wants bn.js#^0.16.0
npm ERR! System Darwin 14.0.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "browserify"
npm ERR! cwd /Users/kanitw/Dropbox/_Projects/_idl/_visrec/vegalite
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/kanitw/Dropbox/_Projects/_idl/_visrec/vegalite/npm-debug.log
npm ERR! not ok code 0
Not sure how to solve it.
(My node version is v0.10.24, I'm on OSX Yosemite)
In order to make the workaround work, you have to
Delete the existing node_modules folder.
npm install miller-rabin#1.1.1 --save-peer
npm install browserify
That works guaranteed.
Had the same issue on Linux. Try running npm update -g
before installing browserify. This has worked for me.
This commit introduced the breaking change: https://github.com/indutny/miller-rabin/commit/bb85f555974587a410a17173f0bc484133b53cb7
The author of the library should fix it, but meanwhile you can:
Delete the existing node_modules folder
npm install miller-rabin#1.1.1 --save-peer
npm install browserify
Recently found this issue on browserify's github.
https://github.com/substack/node-browserify/issues/1049
There is a workaround described.
There are details of a workaround list in the issues on the github page
Error listing
To summarise the solution posted in the issue, you need to install miller-rabin#1.1.1 as a peer-dependency in your own project (npm install miller-rabin#1.1.1 --save-peer) that makes sure the bn.js#0.15 is used rather than the more recent version.
Hope that helps!
Try zipping your existing node_modules and package.json, then delete them.
You may need to 1st generate a new package.json using:
npm init
Then install browserify locally:
npm install browserify
Also, you'll have to install browserify globally:
npm install browserify -g
To zip on CMD or terminal refer to the following article:
How to zip a file using cmd line?

Resources