首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >约曼发生器总是有一些错误。

约曼发生器总是有一些错误。
EN

Stack Overflow用户
提问于 2014-05-23 07:24:20
回答 3查看 1.8K关注 0票数 7

当我尝试使用yeoman生成器时,虽然它是工作的,但是纵观整个生成过程,它总是会给我带来一些错误,不管我使用的是哪个生成器,它们总是存在的。

代码语言:javascript
运行
复制
npm ERR! phantomjs@1.9.7-6 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the phantomjs@1.9.7-6 install script.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Applications/MAMP/htdocs/DECO3800/test
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.10
npm ERR! code ELIFECYCLE

npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Applications/MAMP/htdocs/DECO3800/test/npm-debug.log
npm ERR! not ok code 0

只是想知道为什么会是那样,以及如何解决它,或它完全不影响我建立的网络项目?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2014-05-23 12:02:41

目前Bitbucket CDN似乎存在一个问题。

您可以将此用作临时解决方法:

代码语言:javascript
运行
复制
PHANTOMJS_CDNURL=http://cnpmjs.org/downloads npm install phantomjs
票数 1
EN

Stack Overflow用户

发布于 2014-05-23 11:40:47

我也有同样的问题,我遇到过这样的问题,有人说他找到了一个类似问题的解决办法:https://github.com/Medium/phantomjs/issues/161

“与此相同,它通过从https://bitbucket.org/ariya/phantomjs/downloads下载到它试图将其保存到的路径来工作。bitbucket回购最近在私有/公开之间切换了吗?”

看起来,幻影的下载不再有效(或类似);而且许多人同时也有同样的问题,这说明情况可能是这样的。

我不知道如何去建议你,但也许这能为你指明正确的方向。

票数 0
EN

Stack Overflow用户

发布于 2015-02-26 09:17:24

使用以下设置出现了类似的问题:

  • Windows 7 x64
  • 节点v0.10.32
  • npm v2.5.0
  • yeoman诉1.3.2
  • grunt-cli v0.1.13
  • grunt-html-snap v0.6.1 (grunt-html-快照也有相同的问题)
  • grunt-lib-幻影of v0.3.0 (grunt-html-snap的依赖关系)
  • 幻影of v1.9.15 (依附于咕噜-自由-幻影)

不那么重要的:

  • bower v1.3.12
  • git v1.9.4.msysgit.2

错误:

代码语言:javascript
运行
复制
phantomjs@1.9.15 install d:\TEST\a111\node_modules\grunt-html-s
napshot\node_modules\grunt-lib-phantomjs\node_modules\phantomjs
node install.js

Download already available at C:\Users\USER~1\AppData\Local\Temp\phantomjs\phan
tomjs-1.9.8-windows.zip
Extracting zip contents
Removing d:\TEST\a111\node_modules\grunt-html-snapshot\node_modul
es\grunt-lib-phantomjs\node_modules\phantomjs\lib\phantom
Copying extracted folder C:\Users\USER~1\AppData\Local\Temp\phantomjs\phantomjs
-1.9.8-windows.zip-extract-1424937053563\phantomjs-1.9.8-windows -> d:\SVN\DBITS
\Web\B-RAD\a111\node_modules\grunt-html-snapshot\node_modules\grunt-lib-phantomj
s\node_modules\phantomjs\lib\phantom
Writing location.js file
Phantom installation failed { [Error: EPERM, operation not permitted 'd:\SVN\DBI
TS\Web\B-RAD\a111\node_modules\grunt-html-snapshot\node_modules\grunt-lib-phanto
mjs\node_modules\phantomjs\lib\phantom\phantomjs.exe']
  errno: 50,
  code: 'EPERM',
  path: 'd:\\SVN\\DBITS\\Web\\B-RAD\\a111\\node_modules\\grunt-html-snapshot\\no
de_modules\\grunt-lib-phantomjs\\node_modules\\phantomjs\\lib\\phantom\\phantomj
s.exe',
  syscall: 'chmod' } Error: EPERM, operation not permitted 'd:\SVN\DBITS\Web\B-R
AD\a111\node_modules\grunt-html-snapshot\node_modules\grunt-lib-phantomjs\node_m
odules\phantomjs\lib\phantom\phantomjs.exe'
    at Object.fs.chmodSync (evalmachine.<anonymous>:832:18)
    at Object.chmodSync (d:\TEST\a111\node_modules\grunt-html-sna
pshot\node_modules\grunt-lib-phantomjs\node_modules\phantomjs\node_modules\fs-ex
tra\node_modules\graceful-fs\polyfills.js:141:17)
    at Promise.validExit [as _successFn] (d:\TEST\a111\node_modul
es\grunt-html-snapshot\node_modules\grunt-lib-phantomjs\node_modules\phantomjs\i
nstall.js:145:8)
    at Promise._call (d:\TEST\a111\node_modules\grunt-html-snapsh
ot\node_modules\grunt-lib-phantomjs\node_modules\phantomjs\node_modules\kew\kew.
js:373:13)
    at Promise._withInput (d:\TEST\a111\node_modules\grunt-html-s
napshot\node_modules\grunt-lib-phantomjs\node_modules\phantomjs\node_modules\kew
\kew.js:333:25)
    at Promise.resolve (d:\TEST\a111\node_modules\grunt-html-snap
shot\node_modules\grunt-lib-phantomjs\node_modules\phantomjs\node_modules\kew\ke
w.js:105:27)
    at resolver (d:\TEST\a111\node_modules\grunt-html-snapshot\no
de_modules\grunt-lib-phantomjs\node_modules\phantomjs\node_modules\kew\kew.js:40
9:17)
    at CB (d:\TEST\a111\node_modules\grunt-html-snapshot\node_mod
ules\grunt-lib-phantomjs\node_modules\phantomjs\node_modules\fs-extra\node_modul
es\rimraf\rimraf.js:68:5)
    at Object.oncomplete (fs.js:107:15)
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "grunt-html-snapshot"
npm ERR! node v0.10.32
npm ERR! npm  v2.5.0
npm ERR! code ELIFECYCLE

npm ERR! phantomjs@1.9.15 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs@1.9.15 install script 'node install.js'.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     d:\TEST\a111\npm-debug.log

一开始,我想我用我在github 这里上发布的补丁解决了这个问题。在这个github问题帖子上,您还可以找到其他可能的解决方案。

但几周后,当我试图创建一个新项目时,我遇到了同样的问题.

我的生成器执行以下安装命令:

代码语言:javascript
运行
复制
install: function () {
    var self = this,
        done = self.async();
    self.log(msgStepStart('------- 7: Installing! -------'));

    // ---------- Generate STRUCTURE : Installation of npm packages START ---------- //
    self.npmInstall([
        'grunt@0.4.5',
        'grunt-contrib-clean@0.6.0',
        'grunt-contrib-concat@0.5.0',
        'grunt-contrib-connect@0.9.0',
        'grunt-contrib-copy@0.7.0',
        'grunt-contrib-cssmin@0.11.0',
        'grunt-contrib-htmlmin@0.3.0',
        'grunt-contrib-jshint@0.10.0',
        'grunt-contrib-less@1.0.0',
        'grunt-contrib-uglify@0.7.0',
        'grunt-contrib-watch@0.6.1',
        'grunt-html-snapshot@0.6.1',
        'grunt-rev@0.1.0',
        'grunt-text-replace@0.4.0',
        'grunt-usemin@3.0.0',
        'jit-grunt@0.9.0',
        'jshint-stylish@1.0.0',
        'load-grunt-tasks@2.0.0',
        'lodash@2.4.1',
        'request@2.42.0', // Dependancy: grunt-html-snapshot@0.6.1
        'time-grunt@1.0.0'
    ], { 'save': true, 'saveExact': true }, function() {
        done();
        self.log(msgStepEnd('------- 7: I am done installing! -------'));
    });

    // npm save as save, saveDev or saveExact?
    // --save: Package will appear in your dependencies.
    // --save-dev: Package will appear in your devDependencies.
    // --save-optional: Package will appear in your optionalDependencies.

    // When using any of the above options to save dependencies to your package.json, there is an additional, optional flag:
    // --save-exact: Saved dependencies will be configured with an exact version rather than using npm's default semver range operator. 
    // --save-dev-exact would be the sam as | { 'saveDev': true } => { 'saveDevExact': true }

    // ---------- Generate STRUCTURE : Installation of npm packages END ---------- //

}

我也尝试了幻影故障排除,但没有一个解决了我的问题。

然后,当我试图使用gitbash中的npm命令在一个空文件夹中安装幻影an时,它没有重复地安装任何错误。

代码语言:javascript
运行
复制
$ npm install phantomjs
OR
$ npm install phantomjs@v1.9.15

当我用咕噜-自由-幻影做这件事时,10次中有3次出现了同样的错误。

代码语言:javascript
运行
复制
$ npm install grunt-lib-phantomjs
OR
$ npm install grunt-lib-phantomjs@0.3.0

当我用grunt-html-快照做这件事时,它在10次中得到了相同的错误10次。

代码语言:javascript
运行
复制
$ npm install grunt-html-snapshot
OR
$ npm install grunt-html-snapshot@0.6.1

这让我思考。我在一个新文件夹上安装了带有npm的幻影,并运行了我的生成器。这导致了安装过程中没有错误的10 / 10。

为了让发电机汉德尔完成安装,我在冲突方法下增加了幻影的安装,该生成器的优先级是shure,它是在安装其他npm之前安装的。

代码语言:javascript
运行
复制
conflicts: function () {
    var self = this,
        done = self.async();
    self.log(msgStepStart('------- 6: Handeling Conflicts! -------'));

    self.npmInstall([
        'phantomjs@1.9.15',
    ], {}, function() {
        done();
        self.log(msgStepEnd('------- 6: I handled the conflicts! -------'));
    });
},

这完全解决了我的问题,希望对别人有帮助。

P.S.:

如果使用任何类型的版本控制,则忽略已部署项目的已安装node_modules。您可以考虑在生成器的end方法优先级中使用以下内容。

代码语言:javascript
运行
复制
end: function () {
    var self = this,
        done = self.async();
    self.log(msgStepStart('------- 8: End! -------'));

    self.spawnCommand('npm dedupe').on('exit', function(){
        self.spawnCommand('npm shrinkwrap').on('exit', function(){
            self.log();
            self.log(clc.green('!') + clc.whiteBright(' Successfully created ') + clc.cyan(self.appTitle));
            self.log(clc.green('!') + clc.whiteBright(' To see your site, run:'));
            self.log('\t' + clc.yellowBright('grunt serve'));
            self.log();
            done();
            self.log(msgStepEnd('------- 8: The End! -------'));
        });
    });  
}

此组合将导致在主和依赖级别上安装固定版本的重复安装。

这还将使jsphantom安装保持在主级别上,而不是作为一个依赖项,以避免讨论的错误。因此,当您在没有node_modules文件夹的情况下下载了一个版本化的项目时,将使用以下方法进行干净的安装:

代码语言:javascript
运行
复制
$ npm install
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23823319

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档