简体   繁体   English

错误:ENOENT:没有这样的文件或目录,stat ... .steampath

[英]Error: ENOENT: no such file or directory, stat ... .steampath

I am trying to start the development server on a React project that I have not worked on for a long time.我正在尝试在我已经很长时间没有工作的 React 项目上启动开发服务器。 Upon running npm install and npm start I received the title error message.在运行npm installnpm start ,我收到标题错误消息。
I tried manually updating and then downgrading the Node-sass but I am still getting the same error no matter what I do.我尝试手动更新然后降级 Node-sass,但无论我做什么,我仍然遇到相同的错误。 Here is the full error message I am getting.这是我收到的完整错误消息。

Failed to compile.

./src/App.scss (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-6-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--5-oneOf-6-3!./node_modules/sass-loader/dist/cjs.js??ref--5-oneOf-6-4!./src/App.scss)
Error: Node Sass version 5.0.0 is incompatible with ^4.0.0.
/home/dylan/Desktop/Werk/Professional stuff/SkylimitHost/node_modules/react-scripts/scripts/start.js:19
  throw err;
  ^

[Error: ENOENT: no such file or directory, stat '/home/dylan/.steampath'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'stat',
  path: '/home/dylan/.steampath'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cleanapp@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the cleanapp@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/dylan/.npm/_logs/2020-11-23T05_19_03_778Z-debug.log

And here is the complete log这是完整的日志

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/home/dylan/.nvm/versions/node/v14.15.0/bin/node',
1 verbose cli   '/home/dylan/.nvm/versions/node/v14.15.0/bin/npm',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.14.8
3 info using node@v14.15.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle cleanapp@0.1.0~prestart: cleanapp@0.1.0
6 info lifecycle cleanapp@0.1.0~start: cleanapp@0.1.0
7 verbose lifecycle cleanapp@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle cleanapp@0.1.0~start: PATH: /home/dylan/.nvm/versions/node/v14.15.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/dylan/Desktop/Werk/Professional stuff/SkylimitHost/node_modules/.bin:/home/dylan/.nvm/versions/node/v14.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle cleanapp@0.1.0~start: CWD: /home/dylan/Desktop/Werk/Professional stuff/SkylimitHost
10 silly lifecycle cleanapp@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle cleanapp@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle cleanapp@0.1.0~start: Failed to exec start script
13 verbose stack Error: cleanapp@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/home/dylan/.nvm/versions/node/v14.15.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/home/dylan/.nvm/versions/node/v14.15.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid cleanapp@0.1.0
15 verbose cwd /home/dylan/Desktop/Werk/Professional stuff/SkylimitHost
16 verbose Linux 5.4.0-53-generic
17 verbose argv "/home/dylan/.nvm/versions/node/v14.15.0/bin/node" "/home/dylan/.nvm/versions/node/v14.15.0/bin/npm" "start"
18 verbose node v14.15.0
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error cleanapp@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the cleanapp@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I don't understand why my server won't start, any help would be appreciated.我不明白为什么我的服务器无法启动,我们将不胜感激。

I've found out the solution.我已经找到了解决方案。 This error is just a fancy/convoluted missing dependencies message.此错误只是一个花哨/令人费解的缺少依赖项消息。 If you install all the dependencies the project needs (some might not be in the package.json file) it should work correctly.如果您安装了项目所需的所有依赖项(有些可能不在 package.json 文件中),它应该可以正常工作。

This issue is caused because of some missing dependencies.此问题是由于缺少某些依赖项引起的。 The dependencies which were missing were not listed in the package.json , but was being used in the project.缺少的依赖项没有在package.json列出,但正在项目中使用。 You can see the error for a split second in the console before it clears.在错误清除之前,您可以在控制台中看到一瞬间的错误。 I had to record my screen and see it in slow-mo to find what was missing and installed it.我不得不记录我的屏幕并以慢动作查看它以找到丢失的内容并安装它。

In my case, it was because of a missing package in package.json.就我而言,这是因为 package.json 中缺少一个包。

yarn start or npm run start didn't help me find the missing package. yarn startnpm run start没有帮助我找到丢失的包。 To find the missing one, try running the build command ( yarn build ), build will exit with the error details as below.要找到丢失的,请尝试运行构建命令( yarn build ),构建将退出并显示以下错误详细信息。

在此处输入图片说明

As the above screenshot says, there was a missing package (in my case react-dnd-html5-backend ).正如上面的截图所说,缺少一个包(在我的例子中react-dnd-html5-backend )。

If you are in a hurry!如果你赶时间! And don't have time to know why this is happening!没有时间知道为什么会发生这种情况! you can move and scroll directly to " How to resolve it (an elegant way)? " section bellow (it's at the end)!您可以直接移动并滚动到“如何解决它(一种优雅的方式)? ”部分(在最后)! I'm showing a strong efficient and clean solution!我正在展示一个强大高效和干净的解决方案!

What is the problem ?问题是什么 ?

The whole problem is a missing dependency !整个问题是缺少依赖项 That can be a js module or a file!那可以是一个js模块或一个文件! Like a font file or something else like asset probably!可能像字体文件或其他类似资产的东西!

And to note: A good error message is being cleaned! Recompiling!
And then the problem belloww is reached and you get the error!

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

Then the error comes after!然后错误就来了! We can see a missing font in my case!在我的情况下,我们可以看到缺少字体!

But Why and how we are getting this error ?但是为什么以及我们如何得到这个错误?

A broken symlink that reside in the home directory!驻留在主目录中的损坏符号链接 That got checked by the react-scripts start , running process!react-scripts start , running process 检查! And because it's broken the access throw a is no file or directory error.并且因为它坏了,所以访问抛出一个is no file or directory错误。

In our case it was .steampath !在我们的例子中是.steampath Check the details on the next section ( what is steampath )检查下一节的详细信息(什么是蒸汽路径

To make it fun and confirm!让它变得有趣并确认! I created a broken symlink with my name!我用我的名字创建了一个损坏的符号链接 Following the alphatbetical order!按照字母顺序! It will be processed first!会先处理!

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

And yup!是的! Here now!现在这里! We have .allalBrokenLink !我们有.allalBrokenLink And not .steampath !而不是.steampath A quick solution would be to remove the broken symlink !一个快速的解决方案是删除损坏的符号链接 But this is not a good solution!但这不是一个好的解决方案! the borken .steampath have it's purpose! .steampath有它的目的! If you are using steam game platofrm!如果您使用的是 Steam 游戏平台! If you don't!如果你不! You can remove the file without worry!您可以放心删除文件!

Otherwise the solution is pretty simple and efficient!否则,解决方案非常简单有效! Run in javascript debug terminal!在 javascript 调试终端中运行! And set a breakpoint where the error come!并在错误发生的地方设置断点! So it will pause automatically!所以它会自动暂停! And will get to see the problem easily and simply !并且可以轻松简单地看到问题 See this in the How to resolve it (an elegant way)?如何解决它(一种优雅的方式)中看到这一点 section!部分!

Why the home directory was checked ?为什么要检查主目录?

The first thing to say!首先要说的是! It's not due to the nodejs module resolution algorithm !不是由于 nodejs 模块解析算法 Again not due to the module resolution algorithm !再次不是由于模块解析算法

why!?为什么!?

Because the module resolution!因为模块分辨率! When it comes to the module!说到模块! And in the case where it need to go backward!而在需要倒退的情况下! It Go backward up to the file system root!它倒退到文件系统根目录! And each time checking against node_modules folder!并且每次检查node_modules文件夹! So if it reach up to /home/ !所以如果它达到/home/ it will directly check against /home/node_modules !它会直接检查/home/node_modules if there is!如果有! if not it go to /node_modules !如果不是它去/node_modules And you can see how it will not check all files in a directory!你可以看到它不会检查目录中的所有文件! And so not cause the broken symlink problem .因此不会导致符号链接损坏的问题 Which is caused because something is iterating through all the files and checking them!这是因为某些东西正在遍历所有文件并检查它们! It's not the case here!这里不是这样的!

The algorithm in such case, in extra to that, it check the following在这种情况下的算法,除此之外,它还检查以下内容

Additionally, Node.js will search in the following list of GLOBAL_FOLDERS:此外,Node.js 将在以下 GLOBAL_FOLDERS 列表中搜索:
1: $HOME/.node_modules 1:$HOME/.node_modules
2: $HOME/.node_libraries 2:$HOME/.node_libraries
3: $PREFIX/lib/node 3: $PREFIX/lib/node

That can be illustrated here!这可以在这里说明! I accessed paths while debugging:我在调试时访问了路径:

在此处输入图片说明

You can see how it go backward!你可以看到它是如何倒退的!

The algorithm is clear!算法清晰! You can check it here ( ref1 , ref2 !你可以在这里检查( ref1ref2

And in the typescript doc here并在此处的打字稿文档中

Also we can verify it too ourselves!我们也可以自己验证!

First through accessing module.paths as like bellow:首先通过访问module.paths如下:

在此处输入图片说明

I made a test!我做了一个测试! A simple testing project!一个简单的测试项目! Where i imported just a random name!我只输入了一个随机名称! You'll get a clean not found module error!你会得到一个干净的not found module错误! Know that i tested in the same environment where i get the error bellow!知道我在相同的环境中进行了测试,但出现以下错误!

在此处输入图片说明

And you can check the error type!您可以检查错误类型!

Yup we didn't mention the problem!是的,我们没有提到这个问题! Then what is it ??那这是什么 ??

Babel for example was known for something similar!例如,巴别塔以类似的东西而闻名! Where it looks for .babelrc config.它在哪里寻找.babelrc配置。 However like node modules resolution, it go backward and checking for .babelrc specifically!然而,就像节点模块解析一样,它会向后检查.babelrc专门检查.babelrc And any resolution that have a lockup for a specific thing!以及任何对特定事物有锁定的决议! Or within a specific thing!或者在特定的事物中! Will directly check for the thing!会直接查东西! Why check anything else!?为什么要检查其他东西!? Given all that i doubt it would be something between babel, webpack and react-scripts details or config!鉴于所有我怀疑它会介于 babel、webpack 和 react-scripts 细节或配置之间! And most probably some loader or plugin thing!很可能是一些加载程序或插件的东西! I tried to debug manually!我尝试手动调试! It was time consuming!这很费时间! I moved to automate the detection through the chrome devtools protocol!我开始通过 chrome devtools 协议自动检测! I'll update this section as soon as i get it!我会在收到后立即更新此部分!

What is steampath什么是蒸汽路径

A file created by the Game steam platform .游戏 Steam 平台创建的文件。

https://askubuntu.com/questions/1103540/why-is-there-a-steampath-in-my-home-directory https://askubuntu.com/questions/1103540/why-is-there-a-steampath-in-my-home-directory

This is a known Steam issue: the symlink is created and is intentionally broken for compatibility with older Steamworks SDK that some games are still built with.这是一个已知的 Steam 问题:符号链接被创建并被故意破坏以与某些游戏仍在构建的旧 Steamworks SDK 兼容。

From https://github.com/anyc/steam-overlay/issues/206来自https://github.com/anyc/steam-overlay/issues/206

Steam creates symlink .steampath pointing to nonexistent .steam/sdk32/steam in $HOME every time it is run whereas it should be pointing to .steam/bin32/steam. Steam 每次运行时都会创建符号链接 .steampath 指向 $HOME 中不存在的 .steam/sdk32/steam 而它应该指向 .steam/bin32/steam。

Do not remove or alter this symlink, it exists and is intentionally broken to provide legacy steamworks compatibility as being tracked at ValveSoftware/steam-for-linux#5245.不要删除或更改此符号链接,它存在并被故意破坏以提供在 ValveSoftware/steam-for-linux#5245 中跟踪的旧版 Steamworks 兼容性。

(~/.steam/sdk32/anything is what is needed) (~/.steam/sdk32/什么都是需要的)

So if you use steam !所以如果你使用蒸汽 You probably don't want to remove this file!您可能不想删除此文件!

How to resolve it (an elegant way) ?如何解决它(一种优雅的方式)?

If you don't remember anything!如果你什么都不记得! You can just go find in folder > node_modules !您可以find in folder > node_modules find in folder And search for Failed to compile !并搜索Failed to compile Which generally you'll always remember!通常你会永远记住!

Make sure to pick the second found element!确保选择第二个找到的元素!

在此处输入图片说明

Know that you can too, simply open the file search pallet (CTRL + P)知道您也可以,只需打开文件搜索托盘 (CTRL + P)

Search for devServerUtils搜索devServerUtils

在此处输入图片说明

And search again within the file!并在文件中再次搜索!

在此处输入图片说明

That may be faster!那可能会更快!

After this you set the break points as shown in the next image!在此之后,您设置断点,如下图所示!

And start a debuger terminal!并启动调试器终端!

Know that you need only the breakpoint on the return statement !知道您只需要return 语句上的断点

在此处输入图片说明

You can too use a process.exit() !您也可以使用process.exit() But i prefere the usage of the debugger!但我更喜欢使用调试器! As it's cleaner and simple!因为它更干净和简单!

Here how you start a javascript debug terminal!在这里你如何启动一个 javascript 调试终端!

在此处输入图片说明

Run npm start !运行npm start in that debugger terminal!在那个调试器终端中!

在此处输入图片说明

The excution will automatically stop at the breakpoint !执行会在断点处自动停止 And you'll be able to read easily and simply see what the problem is !而且您将能够轻松阅读并简单地了解问题所在

在此处输入图片说明

Know that once it's done once!一次就知道一次! You can later whenever needed, to just start a javascript debug terminal !您可以稍后在需要时启动javascript 调试终端 And you'll have it works!你会得到它的工作! As your break point will still there!因为你的断点还在那里!

No knowledge is required to do so!无需任何知识即可这样做!

Still if not familiar with the debugger!仍然如果不熟悉调试器! And want to get to know it better!并想更好地了解它!

You can check the debugger auto attach for nodejs processes and javascript debug terminal here您可以在此处检查 nodejs 进程和 javascript 调试终端的调试器自动附加

Also debugging in general调试一般

将 node-sass 降级到版本 4 后,重新启动您的开发服务器。

Make sure to check out your imports!一定要检查你的进口! I'm using VS code and got the very same issue because instead of doing我正在使用 VS 代码并遇到了同样的问题,因为我没有做

import {useHistory} from 'react-router-dom'

// I did (well, actually vscode did it by performing incorrect autoimport)
import {useHistory} from 'react-router'

解决了查看此日志,npm 清除屏幕并丢失所有这些信息。

npm start > log.txt

Some package is missing.缺少一些包。 In my case it was @reduxjs/toolkit.就我而言,它是@reduxjs/toolkit。

In my case, it helped running yarn install before yarn start .就我而言,它有助于在yarn start之前运行yarn install

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:ENOENT:没有这样的文件或目录,stat '/home/arpit/.steampath' - Error: ENOENT: no such file or directory, stat '/home/arpit/.steampath' 错误:ENOENT:没有这样的文件或目录,统计 - Error: ENOENT: no such file or directory, stat UnhandledPromiseRejectionWarning:错误:ENOENT:没有这样的文件或目录,stat&#39;/assets/level.png&#39; - UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, stat '/assets/level.png' 错误:Enoent:没有这样的文件或目录,状态为&#39;D:\\ awesome-testindex.html&#39; - Error :Enoent :no such file or directory ,stat 'D:\awesome-testindex.html' 错误:ENOENT:没有这样的文件或目录,stat Laravel mix bug - Error: ENOENT: no such file or directory, stat Laravel mix bug 错误:ENOENT:没有这样的文件或目录 - Error: ENOENT: no such file or directory 当我导入 BrowserRouter 时,在 reactJS 中遇到此错误“错误:ENOENT:没有此类文件或目录,stat '/initrd.img'” - Encountering this error "Error: ENOENT: no such file or directory, stat '/initrd.img'" in reactJS when i import BrowserRouter 错误:ENOENT:没有这样的文件或目录,错误时统计“/public/main.html”(本机) - Error: ENOENT: no such file or directory, stat '/public/main.html' at Error (native) 服务器给出错误:ENOENT:没有这样的文件或目录,stat &#39;F:\\web development\\calculator\\index.html&#39; - server is giving Error: ENOENT: no such file or directory, stat 'F:\web development\calculator \index.html ' HEROKU 错误:ENOENT:没有这样的文件或目录,stat '/app/distpublic/index.html' - HEROKU Error: ENOENT: no such file or directory, stat '/app/distpublic/index.html'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM