node.js 错误号:34,代码:'ENOENT'
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26117752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
errno: 34, code: 'ENOENT'
提问by bapzangbo
I tried to run my project , but it gave me the ENOENT error somewhere along the way. Yes I have looked at this similarquestion, but its solution doesn't work for me.
我试图运行我的项目,但它在途中的某个地方给了我 ENOENT 错误。是的,我看过这个类似的问题,但它的解决方案对我不起作用。
PROJECTS.JS::CREATED 542a78fcaa50f4260d1e52a5
{ [Error: ENOENT, mkdir '/home/haint/avs3_tmp/html5-videoEditor-master/modules/.. /public/projects/ca62a6012db5454fb0ba41d35f61afe6']
errno: 34,
code: 'ENOENT',
path: '/home/haint/avs3_tmp/html5-videoEditor-master/modules/../public/projects /ca62a6012db5454fb0ba41d35f61afe6' }
{ [Error: ENOENT, mkdir '/home/haint/avs3_tmp/html5-videoEditor-master/modules/.. /public/projects/ca62a6012db5454fb0ba41d35f61afe6/assets/']
errno: 34,
code: 'ENOENT',
path: '/home/haint/avs3_tmp/html5-videoEditor-master/modules/../public/projects /ca62a6012db5454fb0ba41d35f61afe6/assets/' }
{ [Error: ENOENT, mkdir '/home/haint/avs3_tmp/html5-videoEditor-master/modules/.. /public/projects/ca62a6012db5454fb0ba41d35f61afe6/compositions/']
errno: 34,
code: 'ENOENT',
path: '/home/haint/avs3_tmp/html5-videoEditor-master/modules/../public/projects /ca62a6012db5454fb0ba41d35f61afe6/compositions/' }
PROJECTS.JS::FOUND 542a78fcaa50f4260d1e52a5
PROJECTS.JS::LIBRARY SERVED WITH 0 ASSETS
PROJECTS.JS::COMPOSITIONS SERVED WITH 0 COMPS.
how can i fix it
我该如何解决
回答by Chris Lee
Check your path. If you were making multiple levels of directories, you will usually get this.
检查你的路径。如果您正在制作多个级别的目录,您通常会得到这个。
For example. if you need to mkdir('public/projects'), make sure you mkdir('public') first then mkdir('public/projects')
例如。如果您需要 mkdir('public/projects'),请确保首先使用 mkdir('public') 然后 mkdir('public/projects')
Just some sample scripts to demo:
只是一些示例脚本来演示:
var fs = require('fs');
var f = '/css/colors';
var dirs = f.split('/');
var newDir = __dirname;
for (var i = 0; i < dirs.length; i++) {
newDir += dirs[i] + '/';
console.log(newDir);
if (!fs.exists(newDir)) {
fs.mkdir(newDir, function(error) {
console.log(error);
})
}
}
回答by Lucas Coelho
Probably you are on the wrong path.
可能你走错了路。
picture the follow path:
图片如下路径:
/git/react/my-react-app
/git/react/my-react-app
if you are on the reactfolder and try to run a npm startto start up your application, it will prompt an ENOENT.
如果您在该react文件夹中并尝试运行 anpm start来启动您的应用程序,它会提示一个ENOENT.

