通过nodejs

时间:2018-01-02 05:00:28

标签: node.js express npm npm-install npm-cli

我试图通过nodeJS安装express并且我得到的错误告诉我应该重命名我的目录。我已经在我的项目文件夹中运行了npm init,所以我认为设置是正确的。我使用的确切命令是:npm install express --save和npm-debug.log列出了一堆以"傻瓜"开头的语句。但最重要的(imo)如下:

3242 verbose stack Error: EPERM: operation not permitted, rename 'C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron\node_modules\.staging\depd-c51a5acf' -> 'C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron\node_modules\depd'
3242 verbose stack     at destStatted (C:\Program Files\nodejs\node_modules\npm\lib\install\action\finalize.js:25:7)
3242 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29
3242 verbose stack     at FSReqWrap.oncomplete (fs.js:123:15)
3242 verbose stack
3242 verbose stack Error: EPERM: operation not permitted, rename 'C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron\node_modules\.staging\depd-c51a5acf' -> 'C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron\node_modules\depd'
3242 verbose stack     at Error (native)
3243 verbose cwd C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron
3244 error Windows_NT 10.0.16299
3245 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "express" "--save"
3246 error node v6.11.2
3247 error npm  v3.10.10
3248 error path C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron\node_modules\.staging\depd-c51a5acf
3249 error code EPERM
3250 error errno -4048
3251 error syscall rename
3252 error Error: EPERM: operation not permitted, rename 'C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron\node_modules\.staging\depd-c51a5acf' -> 'C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron\node_modules\depd'
3252 error     at destStatted (C:\Program Files\nodejs\node_modules\npm\lib\install\action\finalize.js:25:7)
3252 error     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29
3252 error     at FSReqWrap.oncomplete (fs.js:123:15)
3252 error
3252 error Error: EPERM: operation not permitted, rename 'C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron\node_modules\.staging\depd-c51a5acf' -> 'C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron\node_modules\depd'
3252 error     at Error (native)
3252 error  { Error: EPERM: operation not permitted, rename 'C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron\node_modules\.staging\depd-c51a5acf' -> 'C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron\node_modules\depd'
3252 error     at destStatted (C:\Program Files\nodejs\node_modules\npm\lib\install\action\finalize.js:25:7)
3252 error     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29
3252 error     at FSReqWrap.oncomplete (fs.js:123:15)
3252 error
3252 error Error: EPERM: operation not permitted, rename 'C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron\node_modules\.staging\depd-c51a5acf' -> 'C:\Users\Leungi5368\Documents\CS Education\Side Projects\TimeManagerElectron\TimeManagerElectron\node_modules\depd'
3252 error     at Error (native) parent: 'microtrack' }
3253 error Please try running this command again as root/Administrator.
3254 verbose exit [ -4048, true ]`

背景:我一直在关注YT的Brad Traversy的NodeJS和Express数据库应用系列,试图学习一些在我的项目和他使用的命令中使用的后端内容(如上所列) )完美无瑕地工作。

提前感谢您的任何帮助/建议。

2 个答案:

答案 0 :(得分:0)

检查您的问题是否是由名为 .staging 的目录引起的。通常在目录开头时。 means是一个隐藏的文件夹,所以在这种情况下,安装程序正在避开该文件夹,因此它试图找到路径' C:\ Users \ Leungi5368 \ Documents \ CS Education \ Side Projects \ TimeManagerElectron \ TimeManagerElectron \ node_modules \ depd' ,它不存在

答案 1 :(得分:0)

我正在做更多的研究,我发现在关闭atom IDE 之后运行npm install命令。感谢所有帮助人员!

完整主题:https://github.com/npm/npm/issues/12059 回答页面底部