linnovate / mean

The MEAN stack uses Mongo, Express, Angular(6) and Node for simple and scalable fullstack js applications
http://mean.io
12.13k stars 3.45k forks source link

new meanio install: npm and grunt errors. npm 2.3.0, grunt-cli 0.1.13, node 0.10.36 #1041

Closed laurencefass closed 8 years ago

laurencefass commented 9 years ago

installed a new meanio app. my comments and actions in bold.

$ mean init meanserver

? What would you name your mean app? meanserver ? Do you prefer grunt or gulp as a taskrunner? grunt ? Which mean packages would you like to install? mean-admin Cloning branch: master into destination folder: meanserver Cloning into 'meanserver'... Use mean --help from command line for all CLI options Be sure to checkout all the docs on http://mean.io This may take a little while depending on your connection speed Still cloning... Still cloning... Version: 0.4.3 cloned

[ascii picture goes here]

cp: dest file already exists: Gruntfile.js install dependencies: $ cd meanserver && npm install run the app: $ grunt Extra Docs at http://mean.io git remote upstream set cp: dest file already exists: Gruntfile.js install dependencies: $ cd meanserver && npm install run the app: $ grunt Extra Docs at http://mean.io git remote upstream set

following instructions folder structure as follows

async1@host101:~/public_html/nodetest/meanserver$ ls

bower.json Gruntfile.js LICENSE npm-debug.log packages README.md tools config karma.conf.js mean.json package.json Procfile server.js

npm install?

$npm install

sudo npm install npm ERR! install Couldn't read dependencies npm ERR! Linux 3.2.0-4-amd64 npm ERR! argv "node" "/usr/bin/npm" "install" npm ERR! node v0.10.36 npm ERR! npm v2.3.0 npm ERR! file /home/async1.drupal7.com/public_html/nodetest/meanserver1/package.json npm ERR! code EJSONPARSE

npm ERR! Failed to parse json npm ERR! Unexpected token } npm ERR! File: /home/async1.drupal7.com/public_html/nodetest/meanserver1/package.json npm ERR! Failed to parse package.json data. npm ERR! package.json must be actual JSON, not just JavaScript. npm ERR! npm ERR! This is not a bug in npm. npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request: npm ERR! /home/async1.drupal7.com/public_html/nodetest/meanserver1/npm-debug.log async1@host101:~/public_html/nodetest/meanserver1$ npm install npm ERR! install Couldn't read dependencies npm ERR! Linux 3.2.0-4-amd64 npm ERR! argv "node" "/usr/bin/npm" "install" npm ERR! node v0.10.36 npm ERR! npm v2.3.0 npm ERR! file /home/async1.drupal7.com/public_html/nodetest/meanserver1/package.json npm ERR! code EJSONPARSE

npm ERR! Failed to parse json npm ERR! Unexpected token } npm ERR! File: /home/async1.drupal7.com/public_html/nodetest/meanserver1/package.json npm ERR! Failed to parse package.json data. npm ERR! package.json must be actual JSON, not just JavaScript. npm ERR! npm ERR! This is not a bug in npm. npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request: npm ERR! /home/async1.drupal7.com/public_html/nodetest/meanserver1/npm-debug.log

looking at the npm debug log

async1@host101:~/public_html/nodetest/meanserver1$ cat npm-debug.log 0 info it worked if it ends with ok 1 verbose cli [ 'node', '/usr/bin/npm', 'install' ] 2 info using npm@2.3.0 3 info using node@v0.10.36 4 verbose node symlink /usr/bin/node 5 error install Couldn't read dependencies 6 verbose stack Error: Failed to parse json 6 verbose stack Unexpected token } 6 verbose stack at parseError (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:378:25) 6 verbose stack at parseJson (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:85:51) 6 verbose stack at /usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:59:33 6 verbose stack at evalmachine.:272:14 6 verbose stack at /usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:102:5 6 verbose stack at Object.oncomplete (evalmachine.:108:15) 7 verbose cwd /home/async1.drupal7.com/public_html/nodetest/meanserver 8 error Linux 3.2.0-4-amd64 9 error argv "node" "/usr/bin/npm" "install" 10 error node v0.10.36 11 error npm v2.3.0 12 error file /home/async1.drupal7.com/public_html/nodetest/meanserver1/package.json 13 error code EJSONPARSE 14 error Failed to parse json 14 error Unexpected token } 15 error File: /home/async1.drupal7.com/public_html/nodetest/meanserver1/package.json 16 error Failed to parse package.json data. 16 error package.json must be actual JSON, not just JavaScript. 16 error 16 error This is not a bug in npm. 16 error Tell the package author to fix their package.json file. JSON.parse 17 verbose exit [ 1, true ]

trying to start the server with Grunt.

async1@host101:~/public_html/nodetest/meanserver$ grunt grunt-cli: The grunt command line interface. (v0.1.13)

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or grunt hasn't been installed locally to your project. For more information about installing and configuring grunt, please see the Getting Started guide:

http://gruntjs.com/getting-started async1@host101:~/public_html/nodetest/meanserver$

notes: i installed Grunt with -g so i shouldnt need it locally. Also the Gruntfile is clearly present in the server folder...

any assistance much appreciated.

sk2001 commented 9 years ago

This is because of the generation of the package.json.

The last 3 lines aren't supposed to be there.

{
  "name": "demo",
  "description": "MEAN.io: A fullstack JavaScript framework powered by MongoDB, ExpressJS, AngularJS, NodeJS.",
  "version": "0.4.3",
  "private": false,
  "author": "Linnovate <mean@linnovate.net>",
  "contributors": "https://github.com/linnovate/mean/graphs/contributors",
  "mean": "0.4.3",
  "repository": {
    "type": "git",
    "url": "https://github.com/linnovate/mean.git"
  },
  "engines": {
    "node": "0.10.x",
    "npm": "1.3.x"
  },
  "scripts": {
    "start": "node server",
    "mocha": "node node_modules/.bin/mocha packages/**/server/tests/**/*.js -R spec -r tools/test/mocha-req.js",
    "karma": "node node_modules/karma/bin/karma start",
    "test": "npm run mocha && npm run karma",
    "postinstall": "node node_modules/meanio/node_modules/mean-cli/bin/mean-postinstall"
  },
  "dependencies": {
    "assetmanager": "1.1.2",
    "async": "0.9.0",
    "body-parser": "1.10.0",
    "compression": "1.2.1",
    "connect-flash": "0.1.1",
    "consolidate": "0.10.0",
    "cookie-parser": "1.3.3",
    "errorhandler": "1.3.0",
    "forever": "0.11.1",
    "gridfs-stream": "0.5.3",
    "grunt-cli": "0.1.13",
    "grunt-hook": "~0.3.1",
    "grunt-concurrent": "1.0.0",
    "grunt-contrib-clean": "0.6.0",
    "grunt-contrib-csslint": "0.3.1",
    "grunt-contrib-cssmin": "0.10.0",
    "grunt-contrib-jshint": "0.10.0",
    "grunt-contrib-uglify": "0.5.1",
    "grunt-contrib-watch": "0.6.1",
    "grunt-env": "0.4.2",
    "grunt-nodemon": "0.3.0",
    "load-grunt-tasks": "0.6.0",
    "lodash": "2.4.1",
    "meanio": "0.7.0",
    "mongoose": "3.8.21",
    "morgan": "1.5.0",
    "ms": "0.6.2",
    "nodemailer": "1.2.2",
    "passport-facebook": "1.0.3",
    "passport-github": "0.1.5",
    "passport-google-oauth": "0.1.5",
    "passport-linkedin": "0.1.3",
    "passport-local": "1.0.0",
    "passport-twitter": "1.0.2",
    "serve-favicon": "2.2.0",
    "swig": "1.4.2",
    "time-grunt": "1.0.0",
    "view-helpers": "0.1.5"
  },
  "devDependencies": {
    "expect.js": "0.3.1",
    "grunt-karma": "0.8.3",
    "grunt-mocha-test": "0.10.2",
    "karma": "0.12.28",
    "karma-chrome-launcher": "0.1.7",
    "karma-coffee-preprocessor": "0.2.1",
    "karma-coverage": "0.2.7",
    "karma-firefox-launcher": "0.1.3",
    "karma-html2js-preprocessor": "0.1.0",
    "karma-jasmine": "0.2.3",
    "karma-ng-html2js-preprocessor": "0.1.2",
    "karma-ng-scenario": "0.1.0",
    "karma-phantomjs-launcher": "0.1.4",
    "karma-requirejs": "0.2.2",
    "karma-script-launcher": "0.1.0",
    "mocha": "2.1.0",
    "requirejs": "2.1.15",
    "supertest": "0.11.0",
    "del": "^0.1.3",
    "gulp": "^3.8.8",
    "gulp-concat": "^2.4.1",
    "gulp-csslint": "^0.1.5",
    "gulp-cssmin": "^0.1.6",
    "gulp-jshint": "^1.8.5",
    "gulp-less": "^1.3.6",
    "gulp-livereload": "^2.1.1",
    "gulp-load-plugins": "^0.7.0",
    "gulp-mocha": "^1.1.0",
    "gulp-nodemon": "^1.0.4",
    "gulp-rimraf": "^0.1.1",
    "gulp-uglify": "^1.0.1",
    "gulp-util": "^3.0.1",
    "jshint-stylish": "^1.0.0",
    "through": "^2.3.6"
  }
}
^2.3.6"
  }
}
bogdanmartinescu commented 9 years ago

@sk2001 good catch, I spent 1/2 an hour looking for the problem, finally fixed

laurencefass commented 9 years ago

thanks for your assistance. npm install now working ok (with a few version warnings). problems executing the grunt command. reporting a problem with mongodb and express-session. this is my first time running this stack so i have no idea where to start looking. any help appreciated.

$ grunt

Running "hook" task

Starting hooked tasks.

Running "clean:0" (clean) task

0 paths cleaned.

Running "jshint:all" (jshint) task

42 files lint free.

Running "csslint:src" (csslint) task

5 files lint free.

Running "concurrent:tasks" (concurrent) task Running "watch" task Waiting... Running "nodemon:dev" (nodemon) task [nodemon] v1.2.1 [nodemon] to restart at any time, enter rs [nodemon] watching: . [nodemon] starting node --debug server.js debugger listening on port 5858

/home/nodejs.server.com/meanioserver1/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:297 throw err; ^ Error: Cannot find module 'express-session' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (/home/nodejs.server.com/meanioserver1/node_modules/meanio/lib/core_modules/server/ExpressEngine.js:2:13) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) [nodemon] app crashed - waiting for file changes before starting... ^C

Execution Time (2015-01-30 14:21:26 UTC)

Execution Time (2015-01-30 14:20:54 UTC) loading tasks 20.9s ▇ 1% nodemon:dev 29m 36s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 99% Total 29m 56.9s

Execution Time (2015-01-30 14:21:26 UTC) loading tasks 20.7s ▇ 1% watch 29m 36s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 99% Total 29m 56.7s

loading tasks 29.5s ▇ 2% concurrent:tasks 29m 57.4s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 98% Total 30m 28.5s

laurencefass commented 9 years ago

though i do observe that the /meanioserver1/node_modules/mongoose/node_modules/mongodb/package.json file makes no reference to express-session module but that it is included in the node_modules folder. is there an error in a package.json file?

VikramTiwari commented 8 years ago

Old issue and unrelated now. If any questions please ask in gitter chatroom (https://gitter.im/linnovate/mean).