Can't install js-bson

2019-07-18 22:33发布

问题:

I am using Windows 7 64bit, trying to install bson as a dependencie of mongodb. I get this error:

npm WARN package.json Wochenplaner@0.0.1 No README.md file found!
npm http GET https://registry.npmjs.org/bson
npm http 304 https://registry.npmjs.org/bson

bson@0.1.5 install C:\Users\Administrator\Dropbox\Projekte\Wochenplaner\node_m
odules\bson
node install.js || (exit 0)
CreateProcessW: Das System kann die angegebene Datei nicht finden.
npm ERR! error rolling back Error: ENOTEMPTY, rmdir 'C:\Users\Administrator\Drop
box\Projekte\Wochenplaner\node_modules\bson'
npm ERR! error rolling back bson@0.1.5 { [Error: ENOTEMPTY, rmdir 'C:\Users\Adm
inistrator\Dropbox\Projekte\Wochenplaner\node_modules\bson']
npm ERR! error rolling back errno: 53,
npm ERR! error rolling back code: 'ENOTEMPTY',
npm ERR! error rolling back path: 'C:\Users\Administrator\Dropbox\Projekte
\Wochenplaner\node_modules\bson' }
npm ERR! bson@0.1.5 install: node install.js || (exit 0)
npm ERR! cmd "/c" "node install.js || (exit 0)" failed with 127
npm ERR!
npm ERR! Failed at the bson@0.1.5 install script.
npm ERR! This is most likely a problem with the bson package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js || (exit 0)
npm ERR! You can get their info via:
npm ERR! npm owner ls bson
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7600
npm ERR! command "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nod
ejs\node_modules\npm\bin\npm-cli.js" "install" "bson"
npm ERR! cwd C:\Users\Administrator\Dropbox\Projekte\Wochenplaner
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.69
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\Administrator\Dropbox\Projekte\Wochenplaner\npm-debug.log
npm ERR! not ok code 0

I get this log: http://pastebin.com/B6F2C5um

What is the problem? Also: I tried to install versions 0.1.1, 0.1.2, 0.1.3 etc.

回答1:

I was having the same exact issue and remembered I had fiddled with my PATH variable, recently. It was failing to run cmd.exe.

It was fixed after adding c:\windows\system32 to my PATH.

Per below (note the node issue mentions socket.io, which was also causing similar problems when I tested it):

https://github.com/joyent/node/issues/4222



回答2:

Try deleting C:\Users\Administrator\Drop box\Projekte\Wochenplaner\node_modules and reinstalling.



回答3:

I just installed the bson package on my Win7 (64bit also) box without any issues.

Check the following points.

  • Is your node executable accessible from everywhere? (check with opening a command line and just type node + Enter, if a shell pops up you should be fine)
  • Do you have sufficent access rights for the target folder in question?

Since the main error seems to be CreateProcessW: Das System kann die angegebene Datei nicht finden., i'm pretty sure the first point is the issue.

You could fix that easily by either re-installing node.js or adding the path to your node executable manually to the PATH environment variable.