Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot make npm install -g work for my package

Tags:

node.js

npm

I am trying to add CLI functionality to my npm package intercept-proxy. I couldn't find any good documentation so I basically copied and modified stuff from express.js.

I added:

"bin": {
    "intercept-proxy": "./bin/intercept-proxy"
}

...to my package.json file and created a /bin/intercept-proxy.js which contains the CLI stuff.

When I run:

npm install -g intercept-proxy

... everything works until the linking part. Then it fails, saying:

npm ERR! Error: ENOENT, chmod 'C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules\intercept-proxy\bin\intercept-proxy

... and the log says:

381 info linkStuff [email protected]
382 verbose linkBins [email protected]
383 verbose link bins [ { 'intercept-proxy': './bin/intercept-proxy' },
383 verbose link bins   'C:\\Users\\johan.obrink.24HRCOM\\AppData\\Roaming\\npm',
383 verbose link bins   true ]
384 verbose linkMans [email protected]
385 verbose rebuildBundles [email protected]
386 verbose rebuildBundles [ 'commander', 'mkdirp', 'underscore' ]
387 info C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules\intercept-proxy unbuild
388 verbose from cache C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules\intercept-proxy\package.json
389 info preuninstall [email protected]
390 info uninstall [email protected]
391 verbose true,C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules,C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules unbuild [email protected]
392 verbose C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm,[object Object] binRoot
393 info postuninstall [email protected]
394 error Error: ENOENT, chmod 'C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules\intercept-proxy\bin\intercept-proxy'
395 error If you need help, you may report this log at:
395 error     <http://github.com/isaacs/npm/issues>
395 error or email it to:
395 error     <[email protected]>
396 error System Windows_NT 6.1.7601
397 error command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "intercept-proxy"
398 error cwd c:\src
399 error node -v v0.8.9
400 error npm -v 1.1.61
401 error path C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules\intercept-proxy\bin\intercept-proxy
402 error code ENOENT
403 error errno 34
404 verbose exit [ 34, true ]

I tried googling ENOENT, chown + Windows but don't seem to get any further.

The full code is up at https://github.com/JohanObrink/intercept-proxy

Edit: I have now tried it on OS X and the problem is the same. Not windows related - just me-being-a-n00b related apparently. Still cannot find what's wrong though.

like image 454
Johan Öbrink Avatar asked Oct 18 '12 16:10

Johan Öbrink


People also ask

Why my npm install is not working?

If your npm is broken: On Mac or Linux, reinstall npm. Windows: If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see this note about installing the latest stable version).

How do I force an NPM package to install?

The -f or --force argument will force npm to fetch remote resources even if a local copy exists on disk. The -g or --global argument will cause npm to install the package globally rather than locally.

Does npm install install all packages?

By default, npm install will install all modules listed as dependencies in package. json . With the --production flag (or when the NODE_ENV environment variable is set to production ), npm will not install modules listed in devDependencies .


1 Answers

ENOENT means no such file or directory. What happens if you change to this?

"bin": {
    "intercept-proxy": "./bin/intercept-proxy.js"
}
like image 149
Lars Sjögreen Avatar answered Sep 25 '22 11:09

Lars Sjögreen