我正在尝试设置一个MEAN项目,但似乎无法让生成器工作。我使用以下命令安装了meanjs
生成器:
npm -g install generator-meanjs
我跑了yo meanjs
并回答了有关我的应用程序的问题,但是生成器总是崩溃。
这是我收到的消息:
Running npm install for you....
This may take a couple minutes.
Error: Command failed: /bin/sh -c cd mean && npm install
npm WARN deprecated phantomjs@2.1.7: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'
npm WARN deprecated minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated to-iso-string@0.0.2: to-iso-string has been deprecated, use @segment/to-iso-string instead.
Killed
at ChildProcess.exithandler (child_process.js:213:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:827:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:477:12)
我已经尝试了所有MEAN版本选项,但没有任何改变。以下是运行命令后的文件夹结构:
bower.json Dockerfile LICENSE.md package.json README.md
config gruntfile.js manifest.yml Procfile scripts
CONTRIBUTING.md gulpfile.js modules protractor.conf.js server.js
docker-compose.yml karma.conf.js node_modules public test.js
我能够通过进入package.json并将phantomjs
依赖项重命名为phantomjs-prebuilt
并重新运行npm install
来修复第一个警告。但我找不到文件中提到的其他依赖项,甚至不知道这个解决方案是否能解决我的问题。
我正在运行Ubuntu 14并拥有Python 2.7(我研究的一些事情暗示这可能很重要,以防万一)。
修改
还有一件事:在安装meanjs生成器时,我得到两个弃用警告......不认为这会导致问题,但这可能是罪魁祸首吗?
root@area51:~# npm install -g generator-meanjs
npm WARN deprecated cross-spawn-async@2.2.4: cross-spawn no longer requires a build toolchain, use it instead!
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
这是我的package.json
文件:
{
"name": "mean",
"description": "Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js",
"version": "0.4.2",
"meanjs-version": "0.4.2",
"private": false,
"author": "Danny",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/meanjs/mean.git"
},
"engines": {
"node": ">=0.10.28",
"npm": ">=1.4.28"
},
"scripts": {
"start": "grunt",
"test": "grunt test",
"postinstall": "bower install --config.interactive=false"
},
"dependencies": {
"acl": "~0.4.4",
"async": "^1.3.0",
"body-parser": "^1.13.1",
"bower": "^1.4.1",
"cfenv": "~1.0.0",
"chalk": "^1.1.0",
"compression": "^1.5.0",
"connect-flash": "~0.1.1",
"connect-mongo": "~0.8.1",
"consolidate": "~0.13.1",
"cookie-parser": "^1.3.2",
"crypto": "0.0.3",
"express": "^4.13.1",
"express-session": "^1.11.3",
"file-stream-rotator": "~0.0.6",
"forever": "~0.14.2",
"generate-password": "^1.1.1",
"glob": "^5.0.13",
"grunt": "0.4.5",
"grunt-cli": "~0.1.13",
"helmet": "~0.9.1",
"jasmine-core": "^2.3.4",
"lodash": "^3.10.0",
"method-override": "^2.3.3",
"mocha": "~1.20.0",
"mongoose": "~4.2.3",
"morgan": "^1.6.1",
"multer": "~1.0.5",
"nodemailer": "^1.4.0",
"owasp-password-strength-test": "^1.3.0",
"passport": "~0.2.2",
"passport-facebook": "^2.0.0",
"passport-github": "~0.1.5",
"passport-google-oauth": "~0.2.0",
"passport-linkedin": "~0.1.3",
"passport-local": "^1.0.0",
"passport-paypal-openidconnect": "^0.1.1",
"passport-twitter": "^1.0.2",
"phantomjs": ">=1.9.0",
"serve-favicon": "^2.3.0",
"socket.io": "^1.3.7",
"swig": "^1.4.2",
"validator": "^3.41.2"
},
"devDependencies": {
"coveralls": "^2.11.4",
"grunt-concurrent": "^2.0.0",
"grunt-contrib-copy": "~0.8.0",
"grunt-contrib-csslint": "~0.4.0",
"grunt-contrib-cssmin": "~0.12.3",
"grunt-contrib-jshint": "~0.11.2",
"grunt-contrib-less": "^1.0.1",
"grunt-contrib-sass": "~0.9.2",
"grunt-contrib-uglify": "~0.9.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-env": "~0.4.4",
"grunt-eslint": "~17.3.1",
"grunt-karma": "~0.11.2",
"grunt-mocha-istanbul": "^2.4.0",
"grunt-mocha-test": "~0.12.7",
"grunt-ng-annotate": "^1.0.1",
"grunt-node-inspector": "~0.3.0",
"grunt-nodemon": "~0.4.0",
"grunt-protractor-coverage": "~0.2.15",
"grunt-protractor-runner": "^2.1.0",
"gulp": "^3.9.0",
"gulp-angular-templatecache": "^1.7.0",
"gulp-autoprefixer": "^2.3.1",
"gulp-concat": "^2.6.0",
"gulp-csslint": "~0.1.5",
"gulp-cssmin": "~0.1.7",
"gulp-eslint": "~1.0.0",
"gulp-jshint": "^1.11.2",
"gulp-karma": "~0.0.4",
"gulp-less": "^3.0.3",
"gulp-livereload": "^3.8.0",
"gulp-load-plugins": "^1.0.0-rc.1",
"gulp-mocha": "^2.1.2",
"gulp-ng-annotate": "^1.0.0",
"gulp-nodemon": "^2.0.3",
"gulp-protractor": "^1.0.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.0.3",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.6",
"karma": "~0.12.37",
"karma-chrome-launcher": "~0.2.0",
"karma-coverage": "~0.4.2",
"karma-firefox-launcher": "~0.1.6",
"karma-jasmine": "~0.3.6",
"karma-ng-html2js-preprocessor": "^0.1.2",
"karma-phantomjs-launcher": "~0.2.0",
"load-grunt-tasks": "^3.2.0",
"mock-fs": "~3.4.0",
"run-sequence": "^1.1.1",
"should": "^7.0.1",
"supertest": "^1.0.1"
}
}
另一个编辑
好的,所以我能够通过清除我的npm缓存并运行yo meanjs --skip0install
来安装软件包(我认为)。在克隆了回购后,我运行sudo npm install
并且没有收到我上面提到的KILLED
消息。但是,所有警告和弃用通知仍然存在,当我尝试使用grunt
运行服务器时,我得到:
grunt-cli: The grunt command line interface (v1.2.0)
Fatal error: Unable to find local grunt.
If you're seeing this message, grunt hasn't been installed locally to
your project. For more information about installing and configuring grunt,
please see the Getting Started guide:
我尝试使用npm install grunt-cli
手动安装grunt,但收到相同的消息。我注意到所有grunt工具都在package.json
中引用,所以我想知道是否可能没有安装devDependencies。
现在我的内存泄漏......
(node:11181) Warning: Possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit
这怎么这么搞砸?
答案 0 :(得分:1)
不确定是否有任何帮助,但请查看我的package.json文件,运行npm install
时没有问题
{
"name": "mean"
"description": "Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js",
"version": "0.4.2",
"meanjs-version": "0.4.2",
"private": false,
"author": "Amy",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/meanjs/mean.git"
},
"engines": {
"node": ">=0.10.28",
"npm": ">=1.4.28"
},
"scripts": {
"start": "node server.js",
"test": "grunt test",
"postinstall": "bower install --config.interactive=false"
},
"dependencies": {
"acl": "~0.4.4",
"async": "^1.3.0",
"body-parser": "^1.13.1",
"bower": "^1.4.1",
"cfenv": "~1.0.0",
"chalk": "^1.1.0",
"compression": "^1.5.0",
"connect-flash": "~0.1.1",
"connect-mongo": "~0.8.1",
"consolidate": "~0.13.1",
"cookie-parser": "^1.3.2",
"crypto": "0.0.3",
"express": "^4.13.1",
"express-session": "^1.11.3",
"file-stream-rotator": "~0.0.6",
"forever": "~0.14.2",
"generate-password": "^1.1.1",
"glob": "^5.0.13",
"grunt": "0.4.5",
"grunt-cli": "~0.1.13",
"helmet": "~0.9.1",
"jasmine-core": "^2.3.4",
"lodash": "^3.10.0",
"method-override": "^2.3.3",
"mocha": "~1.20.0",
"moment-timezone": "^0.5.5",
"mongoose": "~4.2.3",
"morgan": "^1.6.1",
"multer": "~1.0.5",
"nodemailer": "^1.4.0",
"owasp-password-strength-test": "^1.3.0",
"passport": "~0.2.2",
"passport-facebook": "^2.0.0",
"passport-github": "~0.1.5",
"passport-google-oauth": "~0.2.0",
"passport-linkedin": "~0.1.3",
"passport-local": "^1.0.0",
"passport-paypal-openidconnect": "^0.1.1",
"passport-twitter": "^1.0.2",
"phantomjs": ">=1.9.0",
"serve-favicon": "^2.3.0",
"socket.io": "^1.3.7",
"stripe": "^4.9.0",
"swig": "^1.4.2",
"validator": "^3.41.2"
},
"devDependencies": {
"coveralls": "^2.11.4",
"grunt-concurrent": "^2.0.0",
"grunt-contrib-copy": "~0.8.0",
"grunt-contrib-csslint": "~0.4.0",
"grunt-contrib-cssmin": "~0.12.3",
"grunt-contrib-jshint": "~0.11.2",
"grunt-contrib-less": "^1.0.1",
"grunt-contrib-sass": "~0.9.2",
"grunt-contrib-uglify": "~0.9.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-env": "~0.4.4",
"grunt-eslint": "~17.3.1",
"grunt-karma": "~0.11.2",
"grunt-mocha-istanbul": "^2.4.0",
"grunt-mocha-test": "~0.12.7",
"grunt-ng-annotate": "^1.0.1",
"grunt-node-inspector": "~0.3.0",
"grunt-nodemon": "~0.4.0",
"grunt-protractor-coverage": "~0.2.15",
"grunt-protractor-runner": "^2.1.0",
"gulp": "^3.9.0",
"gulp-angular-templatecache": "^1.7.0",
"gulp-autoprefixer": "^2.3.1",
"gulp-concat": "^2.6.0",
"gulp-csslint": "~0.1.5",
"gulp-cssmin": "~0.1.7",
"gulp-eslint": "~1.0.0",
"gulp-jshint": "^1.11.2",
"gulp-karma": "~0.0.4",
"gulp-less": "^3.0.3",
"gulp-livereload": "^3.8.0",
"gulp-load-plugins": "^1.0.0-rc.1",
"gulp-mocha": "^2.1.2",
"gulp-ng-annotate": "^1.0.0",
"gulp-nodemon": "^2.0.3",
"gulp-protractor": "^1.0.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.0.3",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.6",
"karma": "~0.12.37",
"karma-chrome-launcher": "~0.2.0",
"karma-coverage": "~0.4.2",
"karma-firefox-launcher": "~0.1.6",
"karma-jasmine": "~0.3.6",
"karma-ng-html2js-preprocessor": "^0.1.2",
"karma-phantomjs-launcher": "~0.2.0",
"load-grunt-tasks": "^3.2.0",
"mock-fs": "~3.4.0",
"run-sequence": "^1.1.1",
"should": "^7.0.1",
"supertest": "^1.0.1"
}
}
答案 1 :(得分:0)
在运行npm -g install generator-meanjs
之前将npm更新为最新版本npm install -g npm