user254883
user254883

Reputation: 605

how to fix UNMET DEPENDENCY errors on expressJS

I'm getting started with express JS and NodeJs using the ExpressJSGuide

I'm stuck at the

npm ls

part, it throws the following errors

└─┬ [email protected] ├── UNMET DEPENDENCY buffer-crc32 0.2.1

├── UNMET DEPENDENCY commander 1.3.2

├── UNMET DEPENDENCY connect 2.14.1

├── UNMET DEPENDENCY cookie 0.1.1

├── UNMET DEPENDENCY cookie-signature 1.0.3

├── UNMET DEPENDENCY debug >= 0.7.3 < 1

├── UNMET DEPENDENCY fresh 0.2.2

├── UNMET DEPENDENCY merge-descriptors 0.0.2

├── UNMET DEPENDENCY methods 0.1.0

├── UNMET DEPENDENCY mkdirp 0.3.5

├── UNMET DEPENDENCY range-parser 1.0.0

└── UNMET DEPENDENCY send 0.2.0

npm ERR! missing: [email protected], required by [email protected]

npm ERR! missing: [email protected], required by [email protected]

npm ERR! missing: [email protected], required by [email protected]

npm ERR! missing: [email protected], required by [email protected]

npm ERR! missing: [email protected], required by [email protected]

npm ERR! missing: [email protected], required by [email protected]

npm ERR! missing: [email protected], required by [email protected]

npm ERR! missing: [email protected], required by [email protected]

npm ERR! missing: [email protected], required by [email protected]

npm ERR! missing: [email protected], required by [email protected]

npm ERR! missing: [email protected], required by [email protected]

npm ERR! missing: debug@>= 0.7.3 < 1, required by [email protected]

npm ERR! not ok code 0

does anyone know how to fix this?

Already tried

npm install dependency-name

like

npm install cookie-signature

but it only thrown the following errors

npm WARN package.json [email protected] No README data

npm WARN package.json [email protected] No README data

npm http GET https://registry.npmjs.org/cookie-signature

npm http 200 https://registry.npmjs.org/cookie-signature

npm http GET https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.3.tgz

npm http 200 https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.3.tgz

npm ERR! Error: EPERM, chown '/misc/htdocs/hello-world/node_modules/cookie-signature/package.json'

npm ERR! { [Error: EPERM, chown '/misc/htdocs/hello-world/node_modules/cookie-signature/package.json']

npm ERR! errno: 50,

npm ERR! code: 'EPERM',

npm ERR! path: '/misc/htdocs/hello-world/node_modules/cookie-signature/package.json',

npm ERR! fstream_finish_call: 'chown',

npm ERR! fstream_type: 'File',

npm ERR! fstream_path: '/misc/htdocs/hello-world/node_modules/cookie-signature/package.json',

npm ERR! fstream_class: 'FileWriter',

npm ERR! fstream_stack:

npm ERR! [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19',

npm ERR! '/usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7',

npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }

npm ERR!

npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 2.6.32-431.5.1.el6.x86_64

npm ERR! command "node" "/usr/bin/npm" "install" "cookie-signature"

npm ERR! cwd /misc/htdocs/hello-world

npm ERR! node -v v0.10.26

npm ERR! npm -v 1.4.6

npm ERR! path /misc/htdocs/hello-world/node_modules/cookie-signature/package.json

npm ERR! fstream_path /misc/htdocs/hello-world/node_modules/cookie-signature/package.json

npm ERR! fstream_type File

npm ERR! fstream_class FileWriter

npm ERR! fstream_finish_call chown

npm ERR! code EPERM

npm ERR! errno 50

npm ERR! stack Error: EPERM, chown '/misc/htdocs/hello-world/node_modules/cookie-signature/package.json'

npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19

npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7

npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)

npm ERR!

npm ERR! Additional logging details can be found in:

npm ERR! /misc/htdocs/hello-world/npm-debug.log

npm ERR! not ok code 0

Upvotes: 2

Views: 7584

Answers (3)

ngrj
ngrj

Reputation: 317

Try this:

sudo npm cache clean -f 
sudo npm install -g n 
sudo n stable 

Actually what it does is, it updates your npm.

Upvotes: 0

FredyC
FredyC

Reputation: 4067

You might try to run npm cache clean. I had similar issues and this solved it for me.

Upvotes: 4

James
James

Reputation: 4737

The first error says that you do not have permission to execute chown on the file package.json. I'm assuming npm is trying to change ownership of that file to do it's thing.

npm ERR! Error: EPERM, chown '/misc/htdocs/hello-world/node_modules/cookie signature/package.json'

In short, it looks like you want to execute npm install with sudo:

sudo npm install dependency-name

Or as root if you don't have sudo:

su
# type your root password at the prompt
npm install dependency-name

Upvotes: 0

Related Questions