用npm安装MongoExpress

时间:2015-09-30 00:36:59

标签: node.js mongodb

在Windows 10上运行'npm install -g mongoexpress'时遇到此错误。

C:\>npm install ­g mongo­express
npm ERR! addLocal Could not install C:\­g
npm ERR! addLocal Could not install C:\mongo­express
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Daniel\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "­g" "mongo­express"
npm ERR! node v4.0.0
npm ERR! npm  v3.3.3
npm ERR! path C:\­g
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'C:\­g'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     C:\npm-debug.log

'C:\ npm-debug.log'的内容是:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Daniel\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '­g',
1 verbose cli   'mongo­express' ]
2 info using npm@3.3.3
3 info using node@v4.0.0
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData ­g
8 silly fetchPackageMetaData mongo­express
9 silly fetchOtherPackageData ­g
10 silly cache add args [ '­g', null ]
11 verbose cache add spec ­g
12 silly fetchOtherPackageData mongo­express
13 silly cache add args [ 'mongo­express', null ]
14 verbose cache add spec mongo­express
15 silly cache add parsed spec Result {
15 silly cache add   raw: '­g',
15 silly cache add   scope: null,
15 silly cache add   name: null,
15 silly cache add   rawSpec: '­g',
15 silly cache add   spec: 'C:\\­g',
15 silly cache add   type: 'local' }
16 silly cache add parsed spec Result {
16 silly cache add   raw: 'mongo­express',
16 silly cache add   scope: null,
16 silly cache add   name: null,
16 silly cache add   rawSpec: 'mongo­express',
16 silly cache add   spec: 'C:\\mongo­express',
16 silly cache add   type: 'local' }
17 error addLocal Could not install C:\­g
18 silly fetchPackageMetaData Error: ENOENT: no such file or directory, open 'C:\­g'
18 silly fetchPackageMetaData     at Error (native)
18 silly fetchPackageMetaData  error for ­g { [Error: ENOENT: no such file or directory, open 'C:\­g'] errno: -4058, code: 'ENOENT', syscall: 'open', path: 'C:\\­g' }
19 error addLocal Could not install C:\mongo­express
20 silly fetchPackageMetaData Error: ENOENT: no such file or directory, open 'C:\mongo­express'
20 silly fetchPackageMetaData     at Error (native)
20 silly fetchPackageMetaData  error for mongo­express { [Error: ENOENT: no such file or directory, open 'C:\mongo­express']
20 silly fetchPackageMetaData   errno: -4058,
20 silly fetchPackageMetaData   code: 'ENOENT',
20 silly fetchPackageMetaData   syscall: 'open',
20 silly fetchPackageMetaData   path: 'C:\\mongo­express' }
21 silly rollbackFailedOptional Starting
22 silly rollbackFailedOptional Finishing
23 silly runTopLevelLifecycles Starting
24 silly runTopLevelLifecycles Finishing
25 silly install printInstalled
26 verbose stack Error: ENOENT: no such file or directory, open 'C:\­g'
26 verbose stack     at Error (native)
27 verbose cwd C:\
28 error Windows_NT 10.0.10240
29 error argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Daniel\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "­g" "mongo­express"
30 error node v4.0.0
31 error npm  v3.3.3
32 error path C:\­g
33 error code ENOENT
34 error errno -4058
35 error syscall open
36 error enoent ENOENT: no such file or directory, open 'C:\­g'
36 error enoent This is most likely not a problem with npm itself
36 error enoent and is related to npm not being able to find a file.
37 verbose exit [ -4058, true ]

看来node正在将-g参数作为文件名来安装表达式?我的理解是,这使得全球可以快速访问。随着这个命令的变化,我遇到了类似的问题。 我此后也遇到了试图安装其他模块的问题。

链接到mongo-express的节点安装站点:https://www.npmjs.com/package/express-mongodb

有人能帮我一把吗?

1 个答案:

答案 0 :(得分:0)

尝试:

npm install -g mongoexpress

g是命令行标志。您正在运行的命令是"安装模块g和模块mongoexpress"而不是"全球安装mongoexpress"。