如何修复现有文件之间的npm安装冲突&;符号链接?
我遇到了一个问题,它似乎检测到了现有文件与同名符号链接之间的冲突。 从项目的根文件夹运行如何修复现有文件之间的npm安装冲突&;符号链接?,npm,continuous-integration,devops,Npm,Continuous Integration,Devops,我遇到了一个问题,它似乎检测到了现有文件与同名符号链接之间的冲突。 从项目的根文件夹运行ls-l时,我看不到任何符号链接。我如何了解NPM的进展情况并解决这一冲突 持续集成生成服务器正在运行:4.4.3=最新的LTS生成 由于此警告,我的localhost节点5.x框切换到使用phantomjs预构建。。。因此,从4.4.3->5.10.1更新节点服务器版本不是问题,也不是正确的修复: npm WARN deprecated phantomjs@2.1.7: Package renamed to
ls-l
时,我看不到任何符号链接。我如何了解NPM的进展情况并解决这一冲突
持续集成生成服务器正在运行:4.4.3=最新的LTS生成
由于此警告,我的localhost节点5.x框切换到使用phantomjs预构建。。。因此,从4.4.3->5.10.1更新节点服务器版本不是问题,也不是正确的修复:
npm WARN deprecated phantomjs@2.1.7: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'
我的*.js代码中没有这两种代码,因此我不知道从何处需要它,也不知道为什么:
require("phantomjs")
require("phantomjs-prebuilt")
在&,上搜索此短语尚未产生足够有用的结果来解决我的问题:
"npm ERR! EEXIST: file already exists, symlink"
以下是我已经尝试运行的内容:
npm uninstall -g phantomjs
npm WARN not installed in /.../.nvm/versions/node/v4/lib/node_modules: "phantomjs"
rm -rf node_modules // to delete that folder
npm install
npm ERR! EEXIST: file already exists, symlink '../phantomjs-prebuilt/bin/phantomjs' -> '/.../node_modules/.bin/phantomjs'
File exists: ../phantomjs-prebuilt/bin/phantomjs
Move it away, and try again.
这个错误的屏幕截图是通过谷歌在网上找到的。滚动到页面的底部。(注意:这是其他人的截图,但看起来与我的截图相似。)
使用npm列表
或npm ls
显示安装了phantomjs:
├── phantomjs@2.1.7
使用npm ls-g
显示一个空白列表。我假设这意味着没有任何包,也没有符号链接安装到全局区域
我已尝试使用以下方法卸载phantomjs:
npm uninstall -g phantomjs
npm WARN not installed in /.../.nvm/versions/node/v4/lib/node_modules: "phantomjs"
我也试着用他回答这个问题时的想法:
brew link --overwrite phantomjs
Warning: Already linked: /usr/local/homebrew/Cellar/phantomjs/2.1.1
To relink: brew unlink phantomjs && brew link phantomjs
这让我从最后一行中选择了第一个选项:
brew unlink phantomjs
Unlinking /usr/local/homebrew/Cellar/phantomjs/2.1.1... 2 symlinks removed
当我重新运行时:
npm install
它仍然会忽略此错误:
npm ERR! EEXIST: file already exists, symlink '../phantomjs-prebuilt/bin/phantomjs' -> '/.../node_modules/.bin/phantomjs'
File exists: ../phantomjs-prebuilt/bin/phantomjs
Move it away, and try again.
如何进一步调试符号链接并修复现有文件和符号链接之间的冲突?在编写此问题并尝试重新创建此问题后,我刚刚解决了这个问题,以便其他人可以调试它。因此,这里是如何修复这个边缘案例错误,以防将来有人遇到它 我只是从package.json文件中删除了这两个文件,然后重新运行
npm install
,看看会发生什么。然后将它们检查到CI服务器中,我可以看到它在做什么。我不得不重新添加第一行“phantomjs”,以使CI服务器通过测试。这是“phantomjs预构建”行,必须删除
这些注释解释了Node.js的4.x和5.x版本应使用哪些选项:
"phantomjs": "^2.1.3", // Leave this in for Node 4.x LTS, remove it with 5.x+
"phantomjs-prebuilt": "^2.1.7", // Removed this with 4.x LTS, but use it with 5.x+
这就是修复CI服务器的原因&允许测试通过!:)
最初,我一直在使用Node 5.6.0(于2016年2月安装),并一直在尝试更新一些Gulp任务,以与现有Node 4.4.3 LTS CI服务器配合使用
Gulp在使用5.6.0时一直抱怨phantomJS,所以我安装了phantomJS
,phantomJS预构建的,并使用——save dev
,以使其停止产生问题。然后从节点5.6.0降级到4.4.3 LTS以调试CI服务器,将抛出符号链接错误(在我上面的问题中提到)
所以如果其他人遇到这个npm错误!EEXIST:
issue以后,请尝试从package.json文件中删除对npm模块的所有引用(错误所指)。然后,如果CI服务器需要,请逐个重新添加它们
符号链接将位于/node_modules/文件夹中的某个位置。My/node\u模块/文件夹有885个子文件夹!我不可能深入研究所有这些问题,试图找出一些较低级别的符号链接有什么问题
不过,如果有人对如何调试符号链接有什么好的建议,我很想了解更多。我会选择好的答案,因为像ls-l符号链接这样易于使用的东西并不存在