Cannot install socket.io on windows Error: connect EACCESS - windows

I am new to what I'm doing now (Node.js,socket.io).
I've already installed Node.js and now I'm trying to install socket.io but I am having this EACCESS error. Thank you for the help!
I'm using Windows 7 x64
I ran cmd with privileges.
and then
npm install socket.io
Here is 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\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'socket.io' ]
2 info using npm#1.3.14
3 info using node#v0.10.22
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose cache add [ 'socket.io', null ]
6 verbose cache add name=undefined spec="socket.io" args=["socket.io",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: 'socket.io',
7 verbose parsed url path: 'socket.io',
7 verbose parsed url href: 'socket.io' }
8 silly lockFile 71475bfd-socket-io socket.io
9 verbose lock socket.io C:\Users\Bobby\AppData\Roaming\npm-cache\71475bfd-socket- io.lock
10 silly lockFile 71475bfd-socket-io socket.io
11 silly lockFile 71475bfd-socket-io socket.io
12 verbose addNamed [ 'socket.io', '' ]
13 verbose addNamed [ null, '*' ]
14 silly lockFile c03de861-socket-io socket.io#
15 verbose lock socket.io# C:\Users\Bobby\AppData\Roaming\npm-cache\c03de861-socket- io.lock
16 silly addNameRange { name: 'socket.io', range: '*', hasData: false }
17 verbose url raw socket.io
18 verbose url resolving [ 'https://registry.npmjs.org/', './socket.io' ]
19 verbose url resolved https://registry.npmjs.org/socket.io
20 info trying registry request attempt 1 at 09:33:49
21 http GET https://registry.npmjs.org/socket.io
22 info retry will retry, error on last attempt: Error: connect EACCES
23 info trying registry request attempt 2 at 09:34:00
24 http GET https://registry.npmjs.org/socket.io
25 info retry will retry, error on last attempt: Error: connect EACCES
26 info trying registry request attempt 3 at 09:35:00
27 http GET https://registry.npmjs.org/socket.io
28 silly lockFile c03de861-socket-io socket.io#
29 silly lockFile c03de861-socket-io socket.io#
30 error Error: connect EACCES
30 error at errnoException (net.js:901:11)
30 error at Object.afterConnect [as oncomplete] (net.js:892:19)
30 error { [Error: connect EACCES] code: 'EACCES', errno: 'EACCES', syscall: 'connect' }
31 error Please try running this command again as root/Administrator.
32 error System Windows_NT 6.1.7601
33 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "socket.io"
34 error cwd C:\node
35 error node -v v0.10.22
36 error npm -v 1.3.14
37 error syscall connect
38 error code EACCES
39 error errno EACCES
40 error stack Error: connect EACCES
40 error stack at errnoException (net.js:901:11)
40 error stack at Object.afterConnect [as oncomplete] (net.js:892:19)
41 verbose exit [ 1, true ]

EACCES means socket.io can't access a port. It might be because you don't have the privileges or the port is already used by another application. You should run this command as an administrator and/or close any process using the port socket.io is trying to access to.
I think it's:
runas /noprofile /root:Administrator npm install socket.io

Related

Unable to compile assets (Laravel Mix)

I'm unable to run npm run dev command, so i could compile my assets via Laravel Mix.
Log of the commmand:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/usr/local/Cellar/node/12.9.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using npm#6.12.0
3 info using node#v12.9.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle #~predev: #
6 info lifecycle #~dev: #
7 verbose lifecycle #~dev: unsafe-perm in lifecycle true
8 verbose lifecycle #~dev: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/mac/Desktop/projects/project/node_modules/$
9 verbose lifecycle #~dev: CWD: /Users/mac/Desktop/projects/project
10 silly lifecycle #~dev: Args: [ '-c', 'npm run development' ]
11 silly lifecycle #~dev: Returned: code: 1 signal: null
12 info lifecycle #~dev: Failed to exec dev script
13 verbose stack Error: # dev: `npm run development`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:209:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:209:13)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid #
15 verbose cwd /Users/max/Desktop/projects/project
16 verbose Darwin 17.7.0
17 verbose argv "/usr/local/Cellar/node/12.9.0/bin/node" "/usr/local/bin/npm" "run" "dev"
18 verbose node v12.9.0
19 verbose npm v6.12.0
20 error code ELIFECYCLE
21 error errno 1
22 error # dev: `npm run development`
22 error Exit status 1
23 error Failed at the # dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Any help with understanding this log/issue would be appreciated.
Manually removing the node and npm directories (https://stackabuse.com/how-to-uninstall-node-js-from-mac-osx/), then installing a fresh node and npm version solved the issue.

yarn permission problems on OSX high sierra

I'm really scratching my head on this one, and have spent around 1.5 days on trying to resolve the problem
the problem I think has to do with permissions that somehow got reset -
I suspect it happened after I got boot camp assistant to partition for windows dual boot
Environment:
Writing selenium test cases in typescript, using Alsatian and Zalenium frameworks over ts-node - the following command being used to initialise the test runner
yarn run ts-node Tests/runner.ts --tap
yarn environment is running through brew
package.json:
{
"dependencies": {
"#types/dotenv": "^4.0.2",
"#types/selenium-webdriver": "^3.0.8",
"alsatian": "^2.2.1",
"axios": "^0.17.1",
"dotenv": "^5.0.0",
"moment": "^2.20.1",
"selenium-webdriver": "^4.0.0-alpha.1",
"tap-spec": "^4.1.1",
"ts-node": "^4.1.0",
"tslib": "1.8.1",
"typescript": "^2.6.2"
}
}
runner.ts:
import tapSpec = require('tap-spec');
import { TestSet, TestRunner } from "alsatian";
import { config as dotenv } from 'dotenv';
(async () =>
{
// Load up any pseudo environment variables
dotenv({ path: __dirname + '/../.env' });
// Setup the alsatian test runner
let testRunner = new TestRunner();
let tapStream = testRunner.outputStream;
let testSet = TestSet.create();
testSet.addTestsFromFiles('/**/*/*.spec.ts');
// This will output a human readable report to the console.
tapStream.pipe(tapSpec()).pipe(process.stdout);
// Runs the tests
await testRunner.run(testSet);
})()
.catch(e =>
{
console.error(e);
process.exit(1);
});
Problem:
I suspect the problems started after I installed dual boot windows using bootcamp assistant
I worked in windows for 3-4 days on another project and when I came back, started getting permission problems
initially they were along the lines of { Error: EACCES: permission denied, scandir '/Library/Application Support/xxxx'
which I resolved using chmod as stated below - now I'm stuck - read points 7 and 8, I don't know whats causing the problem - but I suspect it's yarn permissions
I had - also updated to typescript 2.7.1 earlier because I'm using the option "strictPropertyInitialization": false, in tsconfig - initially I thought that had cause some problem, but reverting to 2.6.2 hasn't resolved it
removed and rebuilt node_modules
ran first aid from disk utility on partition
reset permissions : https://support.apple.com/en-us/HT203538
re-installed yarn
re-installed brew
granted each complained folder sudo chmod -R 777 '/Library/Application Support', now complaining about no access to '/System/Library/User Template' , cannot use chmod here because I get the error, operation not allowed
yarn run ts-node Tests/runner.ts --tap gives:
warning package.json: No license field
$ /Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/.bin/ts-node Tests/runner.ts --tap
{ Error: EACCES: permission denied, scandir '/System/Library/User Template'
at Object.fs.readdirSync (fs.js:924:18)
at GlobSync._readdir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:288:41)
at GlobSync._readdirInGlobStar (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:267:20)
at GlobSync._readdir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:276:17)
at GlobSync._processReaddir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:137:22)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:132:10)0
at GlobSync._processReaddir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:207:10)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:132:10)
at GlobSync._processGlobStar (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:380:10)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:130:10)
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/System/Library/User Template' }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
sudo yarn run ts-node Tests/runner.ts --tap gives:
{ Error: EBADF: bad file descriptor, scandir '/dev/fd/13'
at Object.fs.readdirSync (fs.js:924:18)
at GlobSync._readdir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:288:41)
at GlobSync._readdirInGlobStar (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:267:20)
at GlobSync._readdir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:276:17)
at GlobSync._processReaddir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:137:22)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:132:10)
at GlobSync._processReaddir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:207:10)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:132:10)
at GlobSync._processGlobStar (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:380:10)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:130:10)
errno: -9,
code: 'EBADF',
syscall: 'scandir',
path: '/dev/fd/13' }
error Command failed with exit code 1.
UPDATE 1 - 19 FEB 2017:
I've placed a test.ts file - which does nothing but print to console , if I call that from yarn ts-node, that works fine
yarn run ts-node Tests/test.ts
output:
yarn run v1.3.2
warning package.json: No license field
$ /Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/.bin/ts-node Tests/test.ts
this is a test
✨ Done in 0.61s.
test.ts:
(async () =>
{
console.log("this is a test");
})()
.catch(e =>
{
console.error(e);
process.exit(1);
});
I have also attempted, what the comment has suggested by #ILI - I fixed the permissions using First Aid in disk utility on the mac partition , since brew no longer supports sudo, I uninstalled yarn from brew, and added it to global packages using
sudo yarn install yarn -g
but still have the same EACCESS error - Error: EACCES: permission denied, scandir '/Library/Application Support/OpenVPN/profile'
Also tried running yarn --verbose, didn't get much detail from there
yarn run --verbose ts-node Tests/runner.ts --tap
yarn run v1.3.2
warning package.json: No license field
verbose 0.331 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/.npmrc".
verbose 0.331 Checking for configuration file "/Users/dshamim/.npmrc".
verbose 0.331 Checking for configuration file "/usr/local/etc/npmrc".
verbose 0.332 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/.npmrc".
verbose 0.332 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/anex/.npmrc".
verbose 0.332 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/.npmrc".
verbose 0.332 Checking for configuration file "/Users/dshamim/Projects/Acurus/.npmrc".
verbose 0.332 Checking for configuration file "/Users/dshamim/Projects/.npmrc".
verbose 0.332 Checking for configuration file "/Users/dshamim/.npmrc".
verbose 0.333 Checking for configuration file "/Users/.npmrc".
verbose 0.333 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/.yarnrc".
verbose 0.333 Checking for configuration file "/Users/dshamim/.yarnrc".
verbose 0.334 Found configuration file "/Users/dshamim/.yarnrc".
verbose 0.334 Checking for configuration file "/usr/local/etc/yarnrc".
verbose 0.334 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/.yarnrc".
verbose 0.334 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/anex/.yarnrc".
verbose 0.334 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/.yarnrc".
verbose 0.335 Checking for configuration file "/Users/dshamim/Projects/Acurus/.yarnrc".
verbose 0.337 Checking for configuration file "/Users/dshamim/Projects/.yarnrc".
verbose 0.338 Checking for configuration file "/Users/dshamim/.yarnrc".
verbose 0.338 Found configuration file "/Users/dshamim/.yarnrc".
verbose 0.338 Checking for configuration file "/Users/.yarnrc".
verbose 0.34 current time: 2018-02-19T00:39:49.960Z
$ /Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/.bin/ts-node Tests/runner.ts --tap
{ Error: EACCES: permission denied, scandir '/Library/Application Support/OpenVPN/profile'
at Object.fs.readdirSync (fs.js:924:18)
at GlobSync._readdir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:288:41)
at GlobSync._readdirInGlobStar (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:267:20)
at GlobSync._readdir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:276:17)
at GlobSync._processReaddir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:137:22)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:132:10)
at GlobSync._processReaddir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:207:10)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:132:10)
at GlobSync._processGlobStar (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:380:10)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:130:10)
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/Library/Application Support/OpenVPN/profile' }
verbose 51.049 Error: Command failed with exit code 1.
at /usr/local/Cellar/yarn/1.3.2/libexec/lib/cli.js:35620:15
at Generator.throw (<anonymous>)
at step (/usr/local/Cellar/yarn/1.3.2/libexec/lib/cli.js:92:30)
at /usr/local/Cellar/yarn/1.3.2/libexec/lib/cli.js:105:13
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Some times it's the simple things that we miss, don't worry we have all been here.
This is a case of over thinking the issue, to steal a line from an Aussie beer commercial, you need to "UNDERTHINK IT". https://youtu.be/1MdAhVetBq8
The fact that your simple test script worked but the main test runner didn't, would have pointed me in the direction of stepping through the test runner script, rather than looking at yarn or any other culprit.
Turns out you were telling alsatian to search your entire hard drive for test cases, in which some folders it did not have permissions to access.
Change:
testSet.addTestsFromFiles('/**/*/*.spec.ts');
To:
testSet.addTestsFromFiles('**/*/*.spec.ts');
Or:
testSet.addTestsFromFiles('./**/*/*.spec.ts');
And all should work as you expect.

Heroku Local on exit null throws ERR_UNKNOWN_SIGNAL error

I wanted to set up ENV variables to keep my API keys safe between local and remote Heroku instances. I followed the steps outlined in https://devcenter.heroku.com/articles/heroku-local
When I run heroku local I get a "Error [ERR_UNKNOWN_SIGNAL]: Unknown signal: null" upon exit. Any clues why I would get this? My app is not at all sophisticated.
[OKAY] Loaded ENV .env File as KEY=VALUE Format
[WARN] ENOENT: no such file or directory, open 'Procfile'
[OKAY] package.json file found - trying 'npm start'
18:35:04 web.1 | > youtube-channel-watch#1.0.0 start /Users/farhad/Server/code/2017/tommy/youtube-channel-watch
18:35:04 web.1 | > node app.js
18:35:04 web.1 | WHAT HAPPENED TO MONDAY? Official Trailer (2017) Noomi Rapace Netflix Movie HD
18:35:04 web.1 | https://www.youtube.com/watch?v=POd9-pOCQ7I
18:35:04 web.1 | MOTHER! Official Trailer Teaser (2017) Jennifer Lawrence Horror Drama Movie HD
18:35:04 web.1 | https://www.youtube.com/watch?v=R06aPrUdAtw
[DONE] Killing all processes with signal null
internal/util.js:183
throw new errors.Error('ERR_UNKNOWN_SIGNAL', signal);
^
Error [ERR_UNKNOWN_SIGNAL]: Unknown signal: null
at convertToValidSignal (internal/util.js:183:9)
at ChildProcess.kill (internal/child_process.js:381:5)
at EventEmitter.<anonymous> (/Users/farhad/.local/share/heroku/client/node_modules/foreman/lib/proc.js:54:11)
at emitOne (events.js:120:20)
at EventEmitter.emit (events.js:210:7)
at ChildProcess.<anonymous> (/Users/farhad/.local/share/heroku/client/node_modules/foreman/lib/proc.js:50:13)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
This was fixed in the #heroku/foreman package. Make sure you are using #heroku/foreman and not node-foreman.

Errors with installing gulp

I am trying to install Gulp and gulp-util
This is what i am getting
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\nodejs\\node.exe',
1 verbose cli 'C:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '--save-dev',
1 verbose cli 'gulp-util' ]
2 info using npm#2.15.9
3 info using node#v4.6.0
4 verbose install initial load of C:\Users\icer\Desktop\github\coffeescript\project1\package.json
5 verbose stack Error: Invalid version: "1.0"
5 verbose stack at Object.module.exports.fixVersionField (C:\nodejs\node_modules\npm\node_modules\normalize-package-data\lib\fixer.js:191:13)
5 verbose stack at C:\nodejs\node_modules\npm\node_modules\normalize-package-data\lib\normalize.js:32:38
5 verbose stack at Array.forEach (native)
5 verbose stack at normalize (C:\nodejs\node_modules\npm\node_modules\normalize-package-data\lib\normalize.js:31:15)
5 verbose stack at final (C:\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:349:5)
5 verbose stack at then (C:\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:124:5)
5 verbose stack at ReadFileContext.<anonymous> (C:\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:295:20)
5 verbose stack at ReadFileContext.callback (C:\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16)
5 verbose stack at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:303:13)
6 verbose cwd C:\Users\icer\Desktop\github\coffeescript\project1
7 error Windows_NT 10.0.14393
8 error argv "C:\\nodejs\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save-dev" "gulp-util"
9 error node v4.6.0
10 error npm v2.15.9
11 error Invalid version: "1.0"
12 error If you need help, you may report this error at:
12 error <https://github.com/npm/npm/issues>
13 verbose exit [ 1, true ]

npm version Throwing Up An Error

When I run npm version it's throwing up some errors. Here's the entire npm-debug.log file:
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'version' ]
2 info using npm#2.1.17
3 info using node#v0.10.35
4 verbose node symlink /usr/local/bin/node
5 verbose config Skipping project config: /Users/realph/.npmrc. (matches userconfig)
6 error version Bad package.json data undefined
7 verbose type unexpected_token
8 verbose stack SyntaxError: Unexpected token u
8 verbose stack at Object.parse (native)
8 verbose stack at /usr/local/lib/node_modules/npm/lib/version.js:36:19
8 verbose stack at evalmachine.<anonymous>:208:20
8 verbose stack at OpenReq.Req.done (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:141:5)
8 verbose stack at OpenReq.done (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:61:22)
8 verbose stack at Object.oncomplete (evalmachine.<anonymous>:108:15)
9 verbose cwd /Users/realph
10 error Darwin 14.0.0
11 error argv "node" "/usr/local/bin/npm" "version"
12 error node v0.10.35
13 error npm v2.1.17
14 error Unexpected token u
15 error If you need help, you may report this error at:
15 error <http://github.com/npm/npm/issues>
16 verbose exit [ 1, true ]
Not sure if it's got anything to do with changing my shell to zsh.
Any help is appreciated. Thanks in advance!
There are two issues here.
One is that there's a bug in recent versions of npm where npm version will error if package.json is missing or contains invalid data. https://github.com/npm/npm/issues/7056 That should be fixed with npm#2.2.0 which will officially be latest sometime later today. You can upgrade by following the appropriate instructions here https://github.com/npm/npm/wiki/Troubleshooting#try-the-latest-stable-version-of-npm
The second problem is that your package.json file can't be parsed - please check out the error message above:
Bad package.json data undefined
7 verbose type unexpected_token
8 verbose stack SyntaxError: Unexpected token u
You should inspect your package.json file to see if it is valid JSON http://www.json.org/ (which is a strict subset of javascript, identifier names must be double-quoted, etc.). You can run it through a validator at http://jsonlint.com/

Resources