我正在尝试使用npm install
安装一些依赖项,但我遇到了问题。我是npm的新手,所以我无法弄清楚它的问题是什么?
以下是我的命令及其结果。
npm install - save babelify@7.2.0 browserify-middleware@7.0.0 express@4.13.3 react@0.14.3 reactify@1.1.1 browser-sync@2.10.0 babel-preset-react@6.3.13 babel-preset-es2015@6.3.13 browserify@12.0.1 react-dom@0.14.3 watchify@3.6.1
npm WARN package.json ReactJS_BluePrints_Scaffold@1.0.0 No repository field.
npm http GET https://registry.npmjs.org/babelify/7.2.0
npm http GET https://registry.npmjs.org/browserify-middleware/7.0.0
npm http GET https://registry.npmjs.org/express/4.13.3
npm http GET https://registry.npmjs.org/react/0.14.3
npm http GET https://registry.npmjs.org/reactify/1.1.1
npm http GET https://registry.npmjs.org/browser-sync/2.10.0
npm http GET https://registry.npmjs.org/babel-preset-react/6.3.13
npm http GET https://registry.npmjs.org/babel-preset-es2015/6.3.13
npm http GET https://registry.npmjs.org/browserify/12.0.1
npm http GET https://registry.npmjs.org/react-dom/0.14.3
npm http GET https://registry.npmjs.org/watchify/3.6.1
npm http GET https://registry.npmjs.org/%E2%80%93-save
npm http 304 https://registry.npmjs.org/react/0.14.3
npm http 304 https://registry.npmjs.org/express/4.13.3
npm http 304 https://registry.npmjs.org/browserify-middleware/7.0.0
npm http 304 https://registry.npmjs.org/babelify/7.2.0
npm http 304 https://registry.npmjs.org/reactify/1.1.1
npm http 304 https://registry.npmjs.org/browser-sync/2.10.0
npm http 304 https://registry.npmjs.org/babel-preset-react/6.3.13
npm http 304 https://registry.npmjs.org/babel-preset-es2015/6.3.13
npm http 304 https://registry.npmjs.org/browserify/12.0.1
npm http 304 https://registry.npmjs.org/react-dom/0.14.3
npm http 304 https://registry.npmjs.org/watchify/3.6.1
npm http 404 https://registry.npmjs.org/%E2%80%93-save
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! <npm-@googlegroups.com>
npm ERR! System Linux 4.2.0-27-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "–-save" "babelify@7.2.0" "browserify-middleware@7.0.0" "express@4.13.3" "react@0.14.3" "reactify@1.1.1" "browser-sync@2.10.0" "babel-preset-react@6.3.13" "babel-preset-es2015@6.3.13" "browserify@12.0.1" "react-dom@0.14.3" "watchify@3.6.1"
npm ERR! cwd /home/user/reactapp
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! type non_object_property_load
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/user/reactapp/npm-debug.log
npm ERR! not ok code 0
答案 0 :(得分:1)
保存标记应为--save
,而不是–- save
。由于标记格式错误,npm
将搜索名为–-
的程序包(或自上次编辑后的–-save
)。
试试这个:
npm install --save babelify@7.2.0 browserify-middleware@7.0.0 express@4.13.3 react@0.14.3 reactify@1.1.1 browser-sync@2.10.0 babel-preset-react@6.3.13 babel-preset-es2015@6.3.13 browserify@12.0.1 react-dom@0.14.3 watchify@3.6.1
答案 1 :(得分:0)
您已经获得批准的答案,但我想补充一点,就是遇到了类似的问题,收到了令人沮丧的消息(我在Windows上运行):
TypeError:无法读取未定义的属性“最新”
npm缓存清理
我的问题最终是我安装了两个nodejs。我不知道为什么会导致该错误,但是在我卸载了两个版本并安装了新版本,然后删除了我的应用程序数据中的npm之后,才使npm再次正常工作。
答案 2 :(得分:-1)
好吧,我遇到了同样的问题,我通过安装最新版本的 NodeJS 解决了这个问题。可能是 Node 内部的错误。