2017-09-05 175 views
1

我是新来的角,我想安装角2所需的npm。它在cli git错误。Angular2 NPM安装错误

npm ERR! 404 'types' is not in the npm registry. 
npm ERR! 404 You should bug the author to publish it 
npm ERR! 404 
npm ERR! 404 Note that you can also install from a 
npm ERR! 404 tarball, folder, or http url, or git url. 

npm ERR! System Linux 3.16.0-30-generic 
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" 
npm ERR! cwd /var/www/html/angularDemo 
npm ERR! node -v v0.10.25 
npm ERR! npm -v 1.3.10 
npm ERR! code E404 

npm ERR! TypeError: Cannot read property 'latest' of undefined 
npm ERR!  at next (/usr/share/npm/lib/cache.js:687:35) 
npm ERR!  at /usr/share/npm/lib/cache.js:675:5 
npm ERR!  at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:142:7) 
npm ERR!  at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7 
npm ERR!  at Object.oncomplete (fs.js:107:15) 
npm ERR! If you need help, you may report this log at: 
npm ERR!  <http://github.com/isaacs/npm/issues> 
npm ERR! or email it to: 
npm ERR!  <[email protected]> 

npm ERR! System Linux 3.16.0-30-generic 
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" 
npm ERR! cwd /var/www/html/angularDemo 
npm ERR! node -v v0.10.25 
npm ERR! npm -v 1.3.10 
npm ERR! type non_object_property_load 
npm http 404 https://registry.npmjs.org/angular/router 
npm ERR! TypeError: Cannot read property 'latest' of undefined 
npm ERR!  at next (/usr/share/npm/lib/cache.js:687:35) 
npm ERR!  at /usr/share/npm/lib/cache.js:675:5 
npm ERR!  at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:142:7) 
npm ERR!  at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7 
npm ERR!  at Object.oncomplete (fs.js:107:15) 
npm ERR! If you need help, you may report this log at: 
npm ERR!  <http://github.com/isaacs/npm/issues> 
npm ERR! or email it to: 
npm ERR!  <[email protected]> 

任何人都可以告诉我我在安装时犯的错误。当克隆回购 导航到通过使用所述终端的所述克隆命令创建的文件夹quickstart

安装命令

git clone https://github.com/angular/quickstart.git quickstart 
cd quickstart 
npm install 
npm start 
+0

你可以请你发布'package.json'代码吗? –

回答

0
git clone https://github.com/angular/quickstart.git quickstart 
cd quickstart 
npm install 
npm start 


在终端上输入npm install
安装完成后,键入npm start,即可运行该应用程序。

+0

我想他也是这样做的!你的答案有什么不同? –

1

它看起来像你的npm registry搞砸了。

npm ERR! 404 'types' is not in the npm registry.

执行npm get registry,看看设置哪些注册表。您还可以在类路径中的.npmrc文件中看到该文件。

您可以通过npm set registry https://registry.npmjs.org/或编辑.npmrc文件指向公共npm注册表。