angular-cli: Cannot install @angular/cli because of dependency issue

When I try to install @angular/cli, I get the following error:

npm install -g @angular/cli@latest
npm ERR! code ETARGET
npm ERR! notarget No matching version found for require-from-string@^1.1.0
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'cosmiconfig'
npm ERR! notarget

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dirk/.npm/_logs/2018-01-06T18_58_49_094Z-debug.log

Versions

N/A

Repro steps

Run

npm install @angular/cli@latest

Observed behavior

Angular CLI does not install

Desired behavior

Angular CLI installs

Mention any other details that might be useful (optional)

The package require-from-string seemed to be gone from NPM for a while, but also seems to be back now

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 33
  • Comments: 76 (2 by maintainers)

Most upvoted comments

I just started to learn Angular 5 and reached to this issue post. Just imagine my feelings about my learning trip ^_^

Some russian guy (floatdrop) deleted his account on npm. There are various packages that angular/cli, Vue.js and a whole lot of other projects that depended on his stuff.

temporal solution: npm install https://github.com/floatdrop/require-from-string/tarball/v1.1.0 --save npm install

is like Alfred said in the Batman movie: some people just want to see the world burn

RE: Here it came back working 😃 Same thing up here: It’s aliiiive… It’s aliiiive… Everything is back and running… Yeeeeeeeess 😃

Progress is being made… live update:

jenga2

It’s literally 29 lines of code:

'use strict';

var Module = require('module');
var path = require('path');

module.exports = function requireFromString(code, filename, opts) {
	if (typeof filename === 'object') {
		opts = filename;
		filename = undefined;
	}

	opts = opts || {};
	filename = filename || '';

	opts.appendPaths = opts.appendPaths || [];
	opts.prependPaths = opts.prependPaths || [];

	if (typeof code !== 'string') {
		throw new Error('code must be a string, not ' + typeof code);
	}

	var paths = Module._nodeModulePaths(path.dirname(filename));

	var m = new Module(filename, module.parent);
	m.filename = filename;
	m.paths = [].concat(opts.prependPaths).concat(paths).concat(opts.appendPaths);
	m._compile(code, filename);

	return m.exports;
};

Temp solution doesnt work when i want to install fresh -g cli: sudo npm install -g @angular/cli@latest

@patrickoliveras, Hi! @EstebanFuentealba published a workaround.

npm install https://github.com/floatdrop/require-from-string/tarball/v1.1.0 --save npm install

Regards!

What a lovely start for my Angular training journey 😄 At least I was able to find this issue thread instantly.

@WahidBitar here we go😂😂 it’s our first step upgrading our project to angular 5 💃

@WahidBitar I just started my final year research project. -_- how lucky i am.

It´s Intel! i know it

It seems like npm is not able to find the package require-from-string. So I tried yarn and it worked. Yarn allows you to choose a version for require-from-string

@DirkWillem Yes, It was working fine few hours ago, but broke in last few hours. I’m unable to create new project due to this:

npm ERR! code ETARGET npm ERR! notarget No matching version found for require-from-string@^1.1.0 npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn’t exist. npm ERR! notarget npm ERR! notarget It was specified as a dependency of ‘cosmiconfig’ npm ERR! notarget npm ERR! A complete log of this run can be found in: npm ERR! /home/saad/.npm/_logs/2018-01-06T19_02_10_419Z-debug.log

Note: Creating new project via ng new is also no longer working.

It finally worked! 😃

Left pad all over again.

@EstebanFuentealba temp solution works like a charm

still having issues with require-from-string@^1.1.0

You can check npm status updates here https://status.npmjs.org/

You can use npm view require-from-string versions --json and check if version 1.1.0 is there, instead of trying to reinstall every 5 minutes. When you do eventually see 1.1.0, then we should be back on track for installing angular-cli.

not working npm ERR! code ETARGET npm ERR! notarget No matching version found for require-from-string@^1.1.0 npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn’t exist. npm ERR! notarget npm ERR! notarget It was specified as a dependency of ‘cosmiconfig’ npm ERR! notarget from past 4 hrs at least

but install dont still dont works

Пипец хлопцы, и шо рабить??

Same here @WahidBitar ahah I’m trying to dockerize my MEAN Stack but it fails to build due to that issue…

@WahidBitar it is not an angular related issue. It’s something with npm. Check this issue https://github.com/npm/registry/issues/255