npm ERR! Cannot read property 'path' of null - node.js

**C:\Users\Abc>npm install -g
npm ERR! addLocal Could not install C:\Users\Abc
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe"
"C:\Users\Abc\AppData\Ro
aming\npm\node_modules\npm\bin\npm-cli.js" "install" "-g"
npm ERR! node v7.2.1
npm ERR! npm v4.0.5
npm ERR! Cannot read property 'path' of null
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Abc\npm-debug.log**
i have reinstall node with version 7.2.1
after every time this occurs when i download any package
need suggestion related to null path error

I ran into this issue while installing gulp
My NPM and Node Versions are:
node v7.7.4
npm v4.1.2
In npm version 4x, https client certificates were made required rather than optional. Details are in their github area.
Long story short, what helped for me was running the following command:
npm config set strict-ssl false
Once this was done, running the command
npm install gulp -g
Worked like a charm for me!

If you are working behind proxy, you need to set proxy for nodejs
npm config set proxy http://proxy_host:port
npm config set https-proxy http://proxy_host:port
Hope it Helps.. :)

npm install command is used to install packages.
Reason for your error :
You don't have any package.json in your current working directory.
Also, you didn't provide any package name to install from.
Tips :
Check out https://docs.npmjs.com/cli/install for more details.
Never use -g (install dependency globally unless you intend to).

Related

NPM fails to install types

I have a problem with npm install, in that it won't install #types.
This works fine
npm install --save lodash
However asking for types does not
npm install --save #types/lodash
PS C:\Development\Temp> npm install --save #types/lodash
npm WARN `git config --get remote.origin.url` returned wrong result (git://github.com/types/lodash)
npm WARN `git config --get remote.origin.url` returned wrong result (git#github.com:types/lodash)
npm ERR! git clone git#github.com:types/lodash Cloning into bare repository 'C:\Users\myuser\AppData\Roaming\npm-cache\_git-remotes\git-github-com-types-lodash-9eb5372a'...
npm ERR! git clone git#github.com:types/lodash Host key verification failed.
npm ERR! git clone git#github.com:types/lodash fatal: Could not read from remote repository.
npm ERR! git clone git#github.com:types/lodash
npm ERR! git clone git#github.com:types/lodash Please make sure you have the correct access rights
npm ERR! git clone git#github.com:types/lodash and the repository exists.
npm ERR! addLocal Could not install types/lodash
npm ERR! Error: ENOENT: no such file or directory, stat 'C:\Development\Temp\types\lodash'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Windows_NT 10.0.15063
npm ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\ProgramData\\chocolatey\\lib\\npm\\tools\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "#types/lodash"
npm ERR! cwd C:\Development\Temp
npm ERR! node -v v8.6.0
npm ERR! npm -v 1.4.9
npm ERR! path C:\Development\Temp\types\lodash
npm ERR! syscall stat
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Development\Temp\npm-debug.log
npm ERR! not ok code 0
PS C:\Development\Temp>
This has got me scratching my head. I've updated Chocolatey, NodeJS, NPM to make sure their own the latest versions. Tried the commands on empty folders or an existing TypeScript project - thinking it might be getting confused being ran within a Git repository (error: remote.origin.url). Looking at the GitHub URL it makes no sense git://github.com/types/lodash
I took these examples from MSDN Blog - The Future of Declaration Files
Update: I've uninstalled Node.js and tried reinstalling v6.11.3 LTS or v8.6.0. However the #types command still fails.
Update 2: I've realised Chocolately was masking the npm version. I removed the Chocolately folder, and upgraded npm as per #Louis answer.
Upgrade your npm version to version 4 or 5. I'm mentioning 4 because I ran into problems with 5, and using 4 is still viable. I don't know of any good reason to run an older version.
You are using npm version 1.4.9, as shown in this line of the log:
npm ERR! npm -v 1.4.9
The problem is that npm versions prior to version 2 do not support scoped packages. Packages that begin with an # are scoped packages, so #types/lodash is a scoped package. You need npm version 2 or greater to install it. If you were to use the latest npm in the 1.x series (1.4.29), you'd get a better error message:
npm ERR! Error: This version of npm doesn't support scoped packages (caused by reference to #types/lodash). Update to npm#2+.
Version 1.4.9 did not even know that scoped packages were a thing, so it cannot give a nice error message. It looks like it took the # symbol as signifying that the package name is an address and filled in the missing information with Github as the default host.
The upgrade command I typically use to upgrade npm is:
npm install -g npm
You can specify a specific version by replacing the npm argument with one that gives specific version number. npm#4, for instance, would install the latest npm in the 4.x series. If you don't specify a version number, you get the latest released version.

Ignore ssl signage when installing npm locally to let bower restore packages

I'm trying to locally restore a .bower project. In order to do that I've installed Node.js and the next step is: npm install, this produces the following problem:
My collegue's solved this issue by setting the git config property [http] sslVerify to false.
But this doesn't help for me. We're also working behind a proxy, which has been configured in the .bowerrc file. So it should skip certificate verification entirely.
the .bowerrc file also has it's "strict-ssl" setting set on false.
The error says there is a self signed certificate:
[file location]>npm install
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\n
node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.9.4
npm ERR! npm v3.10.10
npm ERR! code SELF_SIGNED_CERT_IN_CHAIN
npm ERR! self signed certificate in certificate chain
The full error log can be found in npm-debug.log the first error is at line 230: http://www.filedropper.com/npm-debug
I've also tried the command npm install -g bower, but it produces the same problem. According to the bower install guide I should be able to install Node.js and run npm install -g bower.
The solution was to set the registry to http instead of https.
npm config set registry http://registry.npmjs.org/

error while trying to install npm atob

I was trying to install npm atob in my project;but suddenly it is showing an error now as:
Linux 2.6.23.17-88.fc7
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "atob"
npm ERR! node v5.6.0
npm ERR! npm v3.8.8
npm ERR! code CERT_NOT_YET_VALID
npm ERR! certificate is not yet valid
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/www/project/npm-debug.log
but when i searched the most of them have answered as "Fix your system time"
try to correct your system time before to get a valid certification.
Else try to change the version of nodeJs
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
The 'btoa-atob' module does not export a programmatic interface, it only provides command line utilities.
If you need to convert to Base64 you could do so using Buffer:
console.log(new Buffer('Hello World!').toString('base64'));
Reverse (assuming the content you're decoding is a utf8 string):
console.log(new Buffer(b64Encoded, 'base64').toString());
The error code is CERT_NOT_YET_VALID -certificate is not yet valid, and it refers to ssl certificate.
This should fix this error
$ npm config set strict-ssl false
$ npm config set unsafe-perm true
$ npm config set registry http://registry.npmjs.org/

Can't run npm install in an Ember CLI application?

I am setting up an Ember application on a new laptop. I installed node, npm through brew and I also have the Ember CLI. Within the Ember CLI app, I'm trying to do an npm install but when I do, I get this error in the terminal:
npm WARN package.json npm#1.4.21 Non-dependency in bundleDependencies: inherits
npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.33
npm ERR! npm v2.1.11
npm ERR! code E404
npm ERR! 404 Not Found: expresss
npm ERR! 404
npm ERR! 404 'expresss' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'ember-cli'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Nagarjun/Code/sumo-list/web-client/npm-debug.log
I can't run my projects until this is resolved. What am I missing? I even Googled but couldn't find anything for expresss.
My guess is 'expresss' (with an extra s) is a package on npm that was pulled. The dependency was in fact listed in the package.json file for ember-cli but I don't think anyone ever noticed it until later versions.
Proof: https://github.com/stefanpenner/ember-cli/blob/ec8a6ab898599746bddbb8f72f7633c29f0ee95b/package.json#L58
I was able to resolve this issue by uninstalling node and npm completely using brew. Then, installing node.js using the package from nodejs.org. Now, my npm version is 1.4.28. Looks like the issue was caused by the newer npm 2.1.10. Not sure why brew automatically picks up the new npm.
Look in your package.json dependencies section. Looks like a typo.
I faced the same issue but it got fixed by running sudo npm install -g ember-cli

SSL Error: CERT_UNTRUSTED while using npm command

I am trying to install express framework using npm command but getting following error.
error message is
E:\myFindings\nodejs_programs\node>npm install -g express
npm http GET https://registry.npmjs.org/express
npm ERR! Error: SSL Error: CERT_UNTRUSTED
npm ERR! at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\main.js:409:26)
npm ERR! at ClientRequest.g (events.js:185:14)
npm ERR! at ClientRequest.EventEmitter.emit (events.js:88:17)
npm ERR! at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1445:7)
npm ERR! at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:111:23)
npm ERR! at CleartextStream.socketOnData [as ondata] (http.js:1356:20)
npm ERR! at CleartextStream.CryptoStream._push (tls.js:396:27)
npm ERR! at SecurePair.cycle (tls.js:751:20)
npm ERR! at EncryptedStream.CryptoStream.write (tls.js:131:13)
npm ERR! at Socket.ondata (stream.js:38:26)
npm ERR! [Error: SSL Error: CERT_UNTRUSTED]
npm ERR! You may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "express"
npm ERR! cwd E:\myFindings\nodejs_programs\node
npm ERR! node -v v0.8.0
npm ERR! npm -v 1.1.32
npm ERR! message SSL Error: CERT_UNTRUSTED
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! E:\myFindings\nodejs_programs\node\npm-debug.log
npm ERR! not ok code 0
help me to sort out
You can bypass https using below commands:
npm config set strict-ssl false
or set the registry URL from https or http like below:
npm config set registry="http://registry.npmjs.org/"
However, Personally I believe bypassing https is not the real solution, but we can use it as a workaround.
npm ERR! node -v v0.8.0
npm ERR! npm -v 1.1.32
Update your node.js installation.The following commands should do it (from here):
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Edit: okay, if you really have a good reason to run an ancient version of the software, npm set ca null will fix the issue. It happened, because built-in npm certificate has expired over the years.
I had same problem and finally I understood that my node version is old. For example, you can install the current active LTS node version in Ubuntu by the following steps:
sudo apt-get update
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install nodejs -y
Installation instructions for more versions and systems can be found in the following link:
https://github.com/nodesource/distributions/blob/master/README.md
I think I got the reason for the above error. It is the corporate proxy(virtual private network) provided in order to work in the client network. Without that connection I frequently faced the same problem be it maven build or npm install.
If you're behind a corporate proxy, try this setting for npm with your company's proxy:
npm --https-proxy=http://proxy.company.com install express -g
Since i stumbled on the post via google:
Try using npm ci it will be much than an npm install.
From the manual:
In short, the main differences between using npm install and npm ci are:
The project must have an existing package-lock.json or npm-shrinkwrap.json.
If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock.
npm ci can only install entire projects at a time: individual dependencies cannot be added with this command.
If a node_modules is already present, it will be automatically removed before npm ci begins its install.
It will never write to package.json or any of the package-locks: installs are essentially frozen.
Reinstall node, then update npm.
First I removed node
apt-get purge node
Then install node according to the distibution. Docs here .
Then
npm install npm#latest -g
Only recommended if you are running a very old version of node/npm where the certificates have expired or been replaced,
first run npm set ca null
then do your npm install

Resources