生产服务器上的Grunt / npm错误(Ubuntu 14.04.3 LTS)

时间:2015-09-03 08:27:29

标签: angularjs node.js gruntjs npm ubuntu-14.04

我在生产服务器上遇到此错误(Windows和OSX本地都很好)

/home/myuser/my-app/node_modules/grunt/node_modules/findup-sync/lib/findup-sync.js:33
}).flatten().uniq().value();
   ^
TypeError: undefined is not a function
    at Object.module.exports [as findup] (/home/myuser/my-app/node_modules/grunt/node_modules/findup-sync/lib/findup-sync.js:33:8)
    at Task.task.init (/home/myuser/my-app/node_modules/grunt/lib/grunt/task.js:427:16)
    at Object.grunt.tasks (/home/myuser/my-app/node_modules/grunt/lib/grunt.js:120:8)
    at Object.module.exports [as cli] (/home/myuser/my-app/node_modules/grunt/lib/grunt/cli.js:38:9)
    at Object.<anonymous> (/usr/local/lib/node_modules/grunt-cli/bin/grunt:45:20)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)

到目前为止,我尝试删除节点模块,清除缓存并重新安装但没有成功。

rm -rf node_modules && npm cache clean && npm install

我也尝试过安装它抱怨的模块:

 npm install findup-sync -g && npm link findup-sync

此外,我已检查我的 .gitignore 文件是否包含 dist 文件夹

我要粘贴我的package.json和bower.json文件,我们将不胜感激。

谢谢!

  

的package.json

{
  "name": "myapp",
  "version": "1.0.0",
  "dependencies": {
    "bower": "^1.4.1",
    "grunt": "^0.4.5",
    "grunt-cli": "^0.1.13",
    "connect-modrewrite": "^0.8.2",
    "grunt-autoprefixer": "^3.0.3",
    "grunt-concurrent": "^2.0.2 ",
    "grunt-contrib-clean": "^0.6.0",
    "grunt-contrib-compass": "^1.0.3",
    "grunt-contrib-concat": "^0.5.1",
    "grunt-contrib-connect": "^0.8.0",
    "grunt-contrib-copy": "^0.8.1",
    "grunt-contrib-cssmin": "^0.13.0",
    "grunt-contrib-htmlmin": "^0.4.0",
    "grunt-contrib-imagemin": "^0.9.4",
    "grunt-contrib-jshint": "^0.11.2",
    "grunt-contrib-uglify": "^0.9.1",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-filerev": "^2.3.1",
    "grunt-google-cdn": "^0.4.3",
    "grunt-newer": "^1.1.1",
    "grunt-ng-annotate": "^1.0.1",
    "grunt-svgmin": "^2.0.1",
    "grunt-usemin": "^3.1.0",
    "grunt-wiredep": "^2.0.0",
    "load-grunt-tasks": "^3.2.0",
    "time-grunt": "^1.2.1",
    "grunt-ng-constant": "^1.1.0",
    "jasmine-core": "^2.3.4",
    "grunt-karma": "^0.12.0",
    "connect-livereload": "^0.5.3",
    "jshint-stylish": "^2.0.1",
    "karma": "^0.13.9",
    "karma-jasmine": "^0.3.5",
    "karma-phantomjs-launcher": "^0.2.1",
    "phantomjs": "^1.9.18"
  }
}
  

bower.json

{
  "name": "myapp",
  "version": "0.0.1",
  "dependencies": {
    "angular": "^1.3.0",
    "json3": "^3.3.0",
    "es5-shim": "^4.0.0",
    "bootstrap-sass-official": "^3.3.5",
    "angular-animate": "^1.3.0",
    "angular-cookies": "~1.4.0",
    "angular-messages": "^1.3.0",
    "angular-resource": "^1.3.0",
    "angular-route": "^1.3.0",
    "angular-sanitize": "^1.3.0",
    "angular-touch": "^1.3.0",
    "angular-bootstrap": "~0.12.0",
    "font-awesome": "~4.2.0",
    "angular-progress-arc": "~1.0.0",
    "angular-xeditable": "~0.1.9",
    "angular-moment": "~0.10.1",
    "angular-native-picker": "~1.0.4",
    "angular-sweetalert": "~1.1.0",
    "angular-base64": "~2.0.5",
    "angular-timer": "~1.3.3",
    "angular-bootstrap-colorpicker": "~3.0.18"
  },
  "devDependencies": {
  },
  "appPath": "app",
  "resolutions": {
    "angular": "1.4.4"
  }
}

1 个答案:

答案 0 :(得分:1)

我设法找到了它的底部。有点背景,我在DigitalOcean Droplet上遇到了这个问题,这是一个512M RAM / 1 CPU。

由于RAM npm install用于失败/被杀默默的数量有限,因此它无法获得完成安装的机会而且我无法获得错误/警告信息。

所以最后解决方案很简单:增加RAM然后运行-rf node_modules && npm cache clean && npm install,之后它没有任何问题。

希望你们中的一些人会觉得这很有帮助。

TL; DR;尝试增加RAM大小,然后运行-rf node_modules && npm cache clean && npm install