我正试图从私有存储库中安装一个库,并且在尝试使用npm时不断出错。
我使用的是: OSX小牛10.9.3 Node v0.10.28 NPM1.4.10(这是在尝试1.4.13之后安装的,但仍然不起作用)
我正在我的主目录中运行这个文件,~/.npmrc文件就在这个目录中。
每当我运行命令:npm install 'library name here'
我得到以下错误:
npm http GET https://registry.npmjs.org/dslib-js
npm http 404 https://registry.npmjs.org/dslib-js
npm ERR! 404 404 Not Found: dslib-js
npm ERR! 404
npm ERR! 404 'dslib-js' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404
npm ERR! 404 Maybe try 'npm search dslib'
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 Darwin 13.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "dslib-js"
npm ERR! cwd /Users/marcos.pedreiro
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.10
npm ERR! code E404
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/marcos.pedreiro/npm-debug.log
npm ERR! not ok code 0编辑:
当我运行ls -a (在主目录中)时,输出如下:
. .ssh Music
.. .subversion Pictures
.CFUserTextEncoding .vagrant.d Public
.DS_Store Applications VirtualBox VMs
.Trash Desktop clients
.bash_history Documents dev
.gradle Downloads npm-debug.log
.matlab Google Drive ~:.npmrc
.npm Library ~:.npmrc.template
.npmrc.bak Movies这是命令npm config ls -l | grep config的输出
; cli configs
globalconfig = "/usr/local/etc/npmrc"
userconfig = "/Users/marcos.pedreiro/.npmrc"*结束编辑
任何帮助都将不胜感激。谢谢!
发布于 2014-05-27 22:56:21
如果您发布的是ls -a的输出,那么文件名是错误的。
~:.npmrc应该被命名为.npmrc。
开头的~表示使用shell快捷方式将文件放置在主目录中(可能类似于cp .npmrc ~:.npmrc )。问题很可能是结肠。~/将被解释为"my home目录“,但~something/将被解释为名为something的用户的主目录。由于没有用户something,所以系统可能只是将~:作为文字文本处理。
尝试重命名该文件,看看它是否有效:
mv "~:.npmrc" .npmrc发布于 2018-11-05 21:56:38
在我的例子中,字符编码是错误的,因为某种原因,我不得不将它转换为UTF-8。
我用"npm get“来发现问题,结果是充满了u/2411。弦乐。
发布于 2017-01-05 16:55:01
对于运行Windows的人,请检查Windows是否隐藏文件扩展名。对我来说,Windows是说文件名是.npmrc,但真正的文件名是.npmrc.txt。
删除.txt扩展修复了问题。
https://stackoverflow.com/questions/23899093
复制相似问题