tmont / node-sql-generate

Automatically generates SQL definitions for use by the sql NodeJS module
24 stars 9 forks source link

npm install -g sql-generate errors #3

Closed kolexinfos closed 7 years ago

kolexinfos commented 10 years ago

On trying to install on windows xp I am getting this error, here is a stack trace from the log

0 info it worked if it ends with ok 1 verbose cli [ 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Program Files\nodejs\nodemodules\npm\bin\npm-cli.js', 1 verbose cli 'install', 1 verbose cli '-g', 1 verbose cli 'sql-generate' ] 2 info using npm@1.4.3 3 info using node@v0.10.26 4 verbose node symlink C:\Program Files\nodejs\node.exe 5 verbose cache add [ 'sql-generate', null ] 6 verbose cache add name=undefined spec="sql-generate" args=["sql-generate",null] 7 verbose parsed url { protocol: null, 7 verbose parsed url slashes: null, 7 verbose parsed url auth: null, 7 verbose parsed url host: null, 7 verbose parsed url port: null, 7 verbose parsed url hostname: null, 7 verbose parsed url hash: null, 7 verbose parsed url search: null, 7 verbose parsed url query: null, 7 verbose parsed url pathname: 'sql-generate', 7 verbose parsed url path: 'sql-generate', 7 verbose parsed url href: 'sql-generate' } 8 silly lockFile e00d313c-sql-generate sql-generate 9 verbose lock sql-generate C:\Documents and Settings\olusola.kehinde\Application Data\npm-cache\e00d313c-sql-generate.lock 10 silly lockFile e00d313c-sql-generate sql-generate 11 silly lockFile e00d313c-sql-generate sql-generate 12 verbose addNamed [ 'sql-generate', '' ] 13 verbose addNamed [ null, '' ] 14 silly lockFile ad25b435-sql-generate sql-generate@ 15 verbose lock sql-generate@ C:\Documents and Settings\olusola.kehinde\Application Data\npm-cache\ad25b435-sql-generate.lock 16 silly addNameRange { name: 'sql-generate', range: '', hasData: false } 17 verbose url raw sql-generate 18 verbose url resolving [ 'http://registry.npmjs.org/', './sql-generate' ] 19 verbose url resolved http://registry.npmjs.org/sql-generate 20 info trying registry request attempt 1 at 08:13:34 21 verbose etag "3XY19VF4C13PPBN5SO1RG63QI" 22 http GET http://registry.npmjs.org/sql-generate 23 http 304 http://registry.npmjs.org/sql-generate 24 silly registry.get cb [ 304, 24 silly registry.get { 'proxy-connection': 'Keep-Alive', 24 silly registry.get connection: 'Keep-Alive', 24 silly registry.get via: '1.1 varnish, 1.1 HOISA6', 24 silly registry.get date: 'Fri, 25 Apr 2014 07:13:35 GMT', 24 silly registry.get etag: '"3XY19VF4C13PPBN5SO1RG63QI"', 24 silly registry.get 'last-modified': 'Fri, 25 Apr 2014 07:13:35 GMT', 24 silly registry.get 'cache-control': 'max-age=1', 24 silly registry.get 'x-served-by': 'cache-lo80-LHR', 24 silly registry.get 'x-cache': 'MISS', 24 silly registry.get 'x-cache-hits': '0', 24 silly registry.get 'x-timer': 'S1398410015.139239788,VS0,VE258', 24 silly registry.get vary: 'Accept' } ] 25 verbose etag sql-generate from cache 26 silly addNameRange number 2 { name: 'sql-generate', range: '', hasData: true } 27 silly addNameRange versions [ 'sql-generate', 27 silly addNameRange [ '0.1.1', '0.1.2', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.3.0' ] ] 28 verbose addNamed [ 'sql-generate', '0.3.0' ] 29 verbose addNamed [ '0.3.0', '0.3.0' ] 30 silly lockFile 0545ebf8-sql-generate-0-3-0 sql-generate@0.3.0 31 verbose lock sql-generate@0.3.0 C:\Documents and Settings\olusola.kehinde\Application Data\npm-cache\0545ebf8-sql-generate-0-3-0.lock 32 silly lockFile 0545ebf8-sql-generate-0-3-0 sql-generate@0.3.0 33 silly lockFile 0545ebf8-sql-generate-0-3-0 sql-generate@0.3.0 34 silly lockFile ad25b435-sql-generate sql-generate@ 35 silly lockFile ad25b435-sql-generate sql-generate@ 36 silly resolved [ { name: 'sql-generate', 36 silly resolved version: '0.3.0', 36 silly resolved preferGlobal: true, 36 silly resolved description: 'Automatic generation of SQL definitions for use by the sql module', 36 silly resolved keywords: [ 'sql', 'generate' ], 36 silly resolved author: 36 silly resolved { name: 'Tommy Montgomery', 36 silly resolved email: 'tmont@tmont.com', 36 silly resolved url: 'http://tmont.com/' }, 36 silly resolved repository: 36 silly resolved { type: 'git', 36 silly resolved url: 'https://github.com/tmont/node-sql-generate.git' }, 36 silly resolved bin: { 'node-sql-generate': 'bin/node-sql-generate.js' }, 36 silly resolved dependencies: 36 silly resolved { mysql: '2.0.1', 36 silly resolved pg: '2.11.1', 36 silly resolved commander: '2.1.0', 36 silly resolved async: '0.2.10', 36 silly resolved colors: '0.6.2', 36 silly resolved sql: '0.35.0' }, 36 silly resolved devDependencies: { mocha: '1.17.1', should: '3.1.2' }, 36 silly resolved scripts: { test: 'mocha -R spec tests' }, 36 silly resolved readme: '# node-sql-generate\n\nBuild Status\nNPM version\n\nThis library is a command line tool/API for automatically generating\ndefinitions usable by the node-sql library.\nIt inspects your database and generates JavaScript.\n\nCurrently there is support for MySQL and Postgres.\n\n## Installation\nInstall via NPM: npm install -g sql-generate\n\nThis will put the binary node-sql-generate in your path.\n\n## Usage\n### Command line\nIn its simplest form, you do something like this:\nnode-sql-generate --dsn "mysql://user:password@server/database" which will\nspit out the generated code to stdout.\n\njavascript\n// autogenerated by node-sql-generate v0.1.2 on Tue May 21 2013 01:04:12 GMT-0700 (PDT)\nvar sql = require(\'sql\');\n\n/__\n \* SQL definition for database.bar\n */\nexports.bar = sql.define({\n\tname: \'bar\',\n\tcolumns: [\n\t\t\'id\',\n\t\t\'foo_id\'\n\t]\n});\n\n/_*\n \* SQL definition for database.foo\n */\nexports.foo = sql.define({\n\tname: \'foo\',\n\tcolumns: [\n\t\t\'id\',\n\t\t\'field_1\',\n\t\t\'foo_bar_baz\'\n\t]\n});\n`\n\nIf your DSN isn\'t as specific (i.e. it just points to a socket file), then you\'ll\nneed to specify the database and dialect explicitly:\n`node-sql-generate --dsn "/var/run/mysql.sock" --database "test" --dialect "mysql"`\n\nPostgres users will need to specify a schema:\n`node-sql-generate --dsn "postgres://user:password@server/database" --schema "test"`.\n\nOmitting it will assume a schema of "public".\n\n#### `--help`\n`\n Usage: node-sql-generate.js [options]\n\n Options:\n\n -h, --help output usage information\n -V, --version output the version number\n --dsn <dsn> Connection string\n -d, --dialect <dialect> Specify the SQL dialect: "mysql" or "pg"\n -o, --output-file <file> Output to this file; defaults to stdout\n -i, --indent <token> Indentation token; defaults to a TAB character\n -D, --database <name> Name of database to extract from\n -s, --schema <name> Name of schema to extract from (Postgres only)\n --camelize Convert underscored names to camel case, requires sql >= 0.18.0"\n --eol <token> Line terminator token; defaults to "\n"\n --mode <mode> The permission mode of the generated file; defaults to 0644\n --encoding <encoding> The encoding to use for writing; defaults to "utf8"\n --prepend <text> Prepend text to the beginning of the file\n --append <text> Append text to the end of the file\n --modularize Omit "require(\'sql\')" and wrap generated code in "module.exports = function(sql) {...}"\n --omit-comments Omit autogenerated comments\n --include-schema Include schema in definition\n -v, --verbose Print debugging information\n\nExample DSN:\n PostgreSQL: "postgres://user:password@host:5432/database"\n MySQL: "mysql://user:password@host:3306/database"\n`\n\n### API\nYou can also generate these files programmatically.\n\n`javascript\nvar generateSqlDefinition = require(\'sql-generate\'),\n\toptions = {\n\t\tdsn: \'mysql://user:password@host/database\',\n\t\tomitComments: true,\n\t\tprepend: \'// (c) 2013 the raddest dude alive\'\n\t};\n\ngenerateSqlDefinition(options, function(err, stats) {\n\tif (err) {\n\t\tconsole.error(err);\n\t\treturn;\n\t}\n\n\tconsole.log(stats.buffer);\n});\n`\n\n## Development\nTo run the tests, you\'ll need to install [Vagrant](http://www.vagrantup.com/).\n\n`bash\ngit clone git@github.com:tmont/node-sql-generate.git\ncd node-sql-generate\nnpm install\nvagrant up\nnpm test\n', 36 silly resolved readmeFilename: 'README.md', 36 silly resolved bugs: { url: 'https://github.com/tmont/node-sql-generate/issues' }, 36 silly resolved homepage: 'https://github.com/tmont/node-sql-generate', 36 silly resolved _id: 'sql-generate@0.3.0', 36 silly resolved _from: 'sql-generate@' } ] 37 info install sql-generate@0.3.0 into C:\nodejs\node_modules\npm\npm 38 info installOne sql-generate@0.3.0 39 info C:\nodejs\node_modules\npm\npm\node_modules\sql-generate unbuild 40 info preuninstall sql-generate@0.3.0 41 info uninstall sql-generate@0.3.0 42 verbose true,C:\nodejs\node_modules\npm\npm\node_modules,C:\nodejs\node_modules\npm\npm\node_modules unbuild sql-generate@0.3.0 43 verbose C:\nodejs\node_modules\npm\npm,[object Object] binRoot 44 info C:\nodejs\node_modules\npm\npm\node_modules\sql-generate unbuild 45 info preuninstall sql-generate@0.3.0 46 info uninstall sql-generate@0.3.0 47 verbose true,C:\nodejs\node_modules\npm\npm\node_modules,C:\nodejs\node_modules\npm\npm\node_modules unbuild sql-generate@0.3.0 48 verbose C:\nodejs\node_modules\npm\npm,[object Object] binRoot 49 error error rolling back Error: EPERM, unlink 'C:\nodejs\node_modules\npm\npm\node-sql-generate.cmd' 49 error error rolling back sql-generate@0.3.0 { [Error: EPERM, unlink 'C:\nodejs\node_modules\npm\npm\node-sql-generate.cmd'] 49 error error rolling back errno: 50, 49 error error rolling back code: 'EPERM', 49 error error rolling back path: 'C:\nodejs\node_modules\npm\npm\node-sql-generate.cmd' } 50 error Error: EPERM, unlink 'C:\nodejs\node_modules\npm\npm\node-sql-generate.cmd' 50 error { [Error: EPERM, unlink 'C:\nodejs\node_modules\npm\npm\node-sql-generate.cmd'] 50 error errno: 50, 50 error code: 'EPERM', 50 error path: 'C:\nodejs\node_modules\npm\npm\node-sql-generate.cmd' } 51 error Please try running this command again as root/Administrator. 52 error System Windows_NT 5.1.2600 53 error command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "sql-generate" 54 error cwd C:\Documents and Settings\olusola.kehinde 55 error node -v v0.10.26 56 error npm -v 1.4.3 57 error path C:\nodejs\node_modules\npm\npm\node-sql-generate.cmd 58 error code EPERM 59 error errno 50 60 error stack Error: EPERM, unlink 'C:\nodejs\node_modules\npm\npm\node-sql-generate.cmd' 61 verbose exit [ 50, true ]

tmont commented 10 years ago

Based on that error message, have you tried running the command as an administrator?

I haven't tested this on windows, so it just might not work. The modules it uses for connecting to mysql and postgres require compilation, so I'm not sure if that'll work on Windows.