1

我正在尝试通过 nodeJS 安装 express,我得到的错误告诉我应该重命名我的目录。我已经在我的项目文件夹中运行了 npm init,所以我假设设置是正确的。我使用的确切命令是:npm install express --savenpm-debug.log 列出了一堆以“silly”开头的语句,但最重要的语句(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 ]`

背景:我一直在关注 Brad Traversy 在 YT 上的 NodeJS 和 Express 数据库应用程序系列,试图学习一些后端的东西,以便在我的项目中使用,并且他使用的命令(上面列出的)完美无缺。

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

4

2 回答 2

1

我做了更多的研究,发现在关闭 atom IDE 后运行 npm install 命令是有效的。感谢所有的帮助家伙!

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

于 2018-01-02T17:23:16.807 回答
0

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

于 2018-01-02T08:34:46.330 回答