Package.json - not able to install the modules - json

I have a empty folder, In which I created a package.json file, which contains this:
{
"name":"sample project",
"version":"0.0.1",
"title":"My grunt App",
"homepage":"http://gruntjs.com"
}
later on in the same folder, I am trying to run this command:
npm install grunt --save-dev
But I am getting error like this: not able to install the grunt at all
D:\grunt2>npm install grunt --save-dev
npm ERR! Error: Invalid name: "sample project"
npm ERR! at ensureValidName (C:\Program Files (x86)\nodejs\node_modules\npm\
node_modules\read-package-json\node_modules\normalize-package-data\lib\fixer.js:
300:15)
npm ERR! at Object.module.exports.fixNameField (C:\Program Files (x86)\nodej
s\node_modules\npm\node_modules\read-package-json\node_modules\normalize-package
-data\lib\fixer.js:204:5)
npm ERR! at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\read
-package-json\node_modules\normalize-package-data\lib\normalize.js:30:38
npm ERR! at Array.forEach (native)
npm ERR! at normalize (C:\Program Files (x86)\nodejs\node_modules\npm\node_m
odules\read-package-json\node_modules\normalize-package-data\lib\normalize.js:29
:15)
npm ERR! at final (C:\Program Files (x86)\nodejs\node_modules\npm\node_modul
es\read-package-json\read-json.js:342:33)
npm ERR! at then (C:\Program Files (x86)\nodejs\node_modules\npm\node_module
s\read-package-json\read-json.js:126:33)
npm ERR! at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\read
-package-json\read-json.js:316:48
npm ERR! at fs.js:207:20
npm ERR! at OpenReq.Req.done (C:\Program Files (x86)\nodejs\node_modules\npm
\node_modules\graceful-fs\graceful-fs.js:144:5)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "grunt" "--save-d
ev"
npm ERR! cwd D:\grunt2
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! D:\grunt2\npm-debug.log
npm ERR! not ok code 0
Not able to understand the issue. any one help me please?
Actually i am trying to reproduce this tutorial: http://www.anujgakhar.com/2013/02/28/writing-a-simple-grunt-task-using-gruntjs/

Don't use a space in the project name. Change, eg, to sample-project.
(That's the very first error line, btw: Error: Invalid name: "sample project")

The name-field in package.json is invalid, precisely as the error says. Remove the space (use a dot or a dash instead) and it should be fine. According to the developers this is by design since the name will be used in urls, folders etc.

Related

Trying to run Gulp on Mac but it's not working

I'm trying to run Gulp on my Mac. I went into terminal and cd'd into my gulp folder. When I type
gulp
I get "-bash: gulp: command not found". In my gulp folder I do have a gulpfile.js in there but again I get nothing. Where do I go from here?
Here's the errors I get when I npm install -g:
MacBook-Pro-2:gulp-dev damien$ npm install -g gulp
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 minimatch#0.2.14: 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 ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "gulp"
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! path ../lib/node_modules/gulp/bin/gulp.js
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/gulp/bin/gulp.js' -> '/usr/local/bin/gulp'
npm ERR! { Error: EACCES: permission denied, symlink '../lib/node_modules/gulp/bin/gulp.js' -> '/usr/local/bin/gulp'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/gulp/bin/gulp.js',
npm ERR! dest: '/usr/local/bin/gulp' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/damien/.npm/_logs/2017-04-11T20_42_46_317Z-debug.log
MacBook-Pro-2:gulp-dev damien$ npm install -g gulp
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 minimatch#0.2.14: 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 ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "gulp"
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! path ../lib/node_modules/gulp/bin/gulp.js
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/gulp/bin/gulp.js' -> '/usr/local/bin/gulp'
npm ERR! { Error: EACCES: permission denied, symlink '../lib/node_modules/gulp/bin/gulp.js' -> '/usr/local/bin/gulp'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/gulp/bin/gulp.js',
npm ERR! dest: '/usr/local/bin/gulp' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/damien/.npm/_logs/2017-04-11T20_43_48_551Z-debug.log
Have you installed Gulp on your machine yet?
If your folder has a package.json file, make sure you can see Gulp in there listed between your devDependencies. These dependencies are what you use during development of your Node project.
If you don't have a package.json file, you can create one in the command line via npm init, then install Gulp locally on your machine with npm install -g gulp, and then install the command line interface for gulp in your project folder: npm install --save-dev gulp-cli. The CLI will run the Gulp executable with the Gulpfile.js that's in your project.
More information can be found on their website: http://gulpjs.com/

NPM delivered package.json throws error

I have created an NPM package and installed it to test it. NPM/Node throws an ENOENT error when installing dependencies for GruntJS in a nested node_modules folder with npm install.
I take these steps to create the error:
npm install pavilion
cd node_modules/pavilion
npm install
When installing the dependencies for Grunt, listed in the package.json...it throws the error as seen below.
PS. please continue reading below.
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.0.0
npm ERR! npm v3.8.6
npm ERR! path /Users/Baasdesign/Desktop/test/node_modules/pavilion/node_modules/.staging/pavilion-8a19d0be
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/Baasdesign/Desktop/test/node_modules/pavilion/node_modules/.staging/pavilion-8a19d0be' -> '/Users/Baasdesign/Desktop/test/node_modules/pavilion'
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/Baasdesign/Desktop/test/node_modules/pavilion/node_modules/.staging/pavilion-8a19d0be' -> '/Users/Baasdesign/Desktop/test/node_modules/pavilion'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.0.0
npm ERR! npm v3.8.6
npm ERR! path npm-debug.log.575049388
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'npm-debug.log.575049388'
npm ERR! enoent ENOENT: no such file or directory, open 'npm-debug.log.575049388'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Baasdesign/Desktop/test/node_modules/pavilion/npm-debug.log
Now the weird part. When I use Bower to install the package...I don't get the error. Here are my steps:
bower install pavilion
cd bower_components/pavilion
npm install
Everything installs fine. The difference? ---> the package.json.
The bower install package.json works find. NPM's doesn't.
Bower gives me a clean package.json, as created by myself before publishing to npm.
NPM install gives me an package.json that had a lot more info in there. When I use the bower package.json...everything install fine...even when I paste and replace the npm package.json in the node_modules folder.
What's the deal here? It seems that the package.json delivered with the npm install messes up the dependency installation.
Here is the bower package.json delivery:
http://pastebin.com/g8FgSDNG
And here is the npm package.json delivery:
http://pastebin.com/xTiQ15ih
I have tried npm cache clean but it didn't work.
sysinfo:
OSX Yosemite
node - 5.10.1
npm - 3.8.6
Node is brilliant but can be a pain sometimes!
I have had this error myself lately and for me rolling back to an earlier version of node fixed my problem.
I would recommend you try out an earlier install you could use "node version manager" to have a few node versions on your system and it provides methods to switch between versions.
I know its not a very technical answer and i hope someone has a specific answer to your question!
[https://github.com/creationix/nvm]
Here's the version manager link hope it helps
The problem was that I didn't save the dependency in the package.json.
I guess Node gets the paths wrong if you do that.
So the correct workflow is:
npm init (create the package.json)
npm install <package> --save-dev
cd node_modules/pavilion
npm install
Then it works fine. The <package> needs to be added to the parent directory's package.json.

KOA - dependency for mysql error

I am a newbie to KOA framework, facing a issue while installing the mysql dependency using this command npm install knex-mysql-middleware on my windows xp machine. Below is the message i am getting on my console.
npm WARN package.json path#0.11.14 path is also the name of a node core module.
npm ERR! Error: ENOENT, chmod 'E:\testkoa\app3\node_modules\knex-mysql-middleware\node_modules\mysql\node_modules\readable-stream\node_modules\inherits\inherits.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Windows_NT 5.1.2600
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "knex-mysql-middleware"
npm ERR! cwd E:\testkoa\app3
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.14
npm ERR! path E:\testkoa\app3\node_modules\knex-mysql-middleware\node_modules\mysql\node_modules\readable-stream\node_modules\inherits\inherits.js
npm ERR! fstream_path E:\testkoa\app3\node_modules\knex-mysql-middleware\node_modules\mysql\node_modules\readable-stream\node_modules\inherits\inherits.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chmod
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fstream\lib\writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat 'E:\testkoa\app3\node_modules\knex-mysql-middleware\node_modules\mysql\node_modules\readable-stream\node_modules\core-util-is\float.patch'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
I've had a very similar problem before. You might try running:
npm cache clean
and see if that makes any difference.

phone gap cordova installation

I'm trying to install phonegap but getting following error message. I have tried this for cordova also but of no use, Please help me
Your environment has been set up for using Node.js 0.10.33 (x64) and npm.
C:\Users\saiki>install -g phonegap
'install' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\saiki>npm install -g phonegap
/
> ws#0.4.31 install C:\Users\saiki\AppData\Roaming\npm\node_modules\phonegap\nod
e_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_mo
dules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
\
C:\Users\saiki\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-ph
onegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws>node "C:\Pr
ogram Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\n
ode-gyp\bin\node-gyp.js" rebuild
/
> ws#0.4.31 install C:\Users\saiki\AppData\Roaming\npm\node_modules\phonegap\nod
e_modules\connect-phonegap\node_modules\socket.io\node_modules\socket.io-client\
node_modules\engine.io-client\node_modules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
C:\Users\saiki\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-ph
onegap\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.
io-client\node_modules\ws>node "C:\Program Files (x86)\nodejs\node_modules\npm\b
in\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
npm ERR! Failed to parse json
npm ERR! Unexpected token
npm ERR! File: C:\Users\saiki\AppData\Roaming\npm-cache\lodash\2.4.1\package\pac
kage.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! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "phonegap"
npm ERR! cwd C:\Users\saiki
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! file C:\Users\saiki\AppData\Roaming\npm-cache\lodash\2.4.1\package\pack
age.json
npm ERR! code EJSONPARSE
npm ERR! not ok code 0
C:\Users\saiki>
please reply me as soon as possible.
Some text to make this post work or just to get submitted
Thanks in advance

npm package build failing, how best to debug?

I'm trying to install a mysql node package on Mac OS X. I'm trying to run a client project locally.
I have node and npm installed already and they work fine, other packages have installed fine. I've also compiled/installed the full LAMP stack.
When the build below fails, I'm not seeing any error messages that are helpful - just information about a library not being found. Without knowing what it can't find, I can't fix it.
Any advice? MySQL has been installed the standard way - downloaded packages, ./configure'd, make/install.
$ npm install mysql-libmysqlclient
npm http GET https://registry.npmjs.org/mysql-libmysqlclient
npm http 304 https://registry.npmjs.org/mysql-libmysqlclient
> mysql-libmysqlclient#1.3.3 install /Users/botskonet/node_modules/mysql-libmysqlclient
> node-gyp rebuild
info it worked if it ends with ok
spawn python [ '/Users/botskonet/.node-gyp/0.6.12/tools/gyp_addon',
'binding.gyp',
'-I/Users/botskonet/node_modules/mysql-libmysqlclient/build/config.gypi',
'-f',
'make' ]
spawn make [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings.o
CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_connection.o
CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_result.o
CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_statement.o
SOLINK_MODULE(target) Release/mysql_bindings.node
ld: library not found for -lmysqlclient_r
collect2: ld returned 1 exit status
make: *** [Release/mysql_bindings.node] Error 1
ERR! Error: `make` failed with exit code: 2
at Array.0 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:176:25)
at EventEmitter._tickCallback (node.js:192:40)
ERR! not ok
npm ERR! mysql-libmysqlclient#1.3.3 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the mysql-libmysqlclient#1.3.3 install script.
npm ERR! This is most likely a problem with the mysql-libmysqlclient package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls mysql-libmysqlclient
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Darwin 11.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "mysql-libmysqlclient"
npm ERR! cwd /Users/botskonet/Sites/SportsBuddies
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.15
npm ERR! code ELIFECYCLE
npm ERR! message mysql-libmysqlclient#1.3.3 install: `node-gyp rebuild`
npm ERR! message `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/botskonet/Sites/SportsBuddies/npm-debug.log
npm not ok
Look at the dependencies section in README and issues #107. To build mysql-libmysqlclient you should install both libmysqlclient and development headers for it, add path to your MySQL bin dir to $PATH and path to your MySQL lib dir to $DYLD_LIBRARY_PATH.