javascript npm无法找到文件

xa9qqrwz  于 2023-01-29  发布在  Java
关注(0)|答案(3)|浏览(108)

我目前正在尝试遵循一个关于如何制作谷歌Map克隆的教程,我现在已经完成了构建,然后我试图运行npm启动命令,但当我这样做时,我得到以下错误:

npm ERR! code ENOENT

npm ERR! syscall open

npm ERR! path C:\Users\mikai\OneDrive\Skrivebord\Code\websites\Maps\package.json

npm ERR! errno -4058

npm ERR! enoent ENOENT: no such file or directory, open 
'C:\Users\example\example\example\example\example\example\example'

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

我已经尝试通过运行npm cache clean命令来清除缓存,然后运行npm start,但我仍然得到相同的错误,有人遇到过相同的错误并找到了解决方案吗?
这里的链接到教程:https://javascript.plainenglish.io/build-a-google-maps-clone-in-less-than-20-minutes-6f7c68db13e
下面是package.json文件:

{
 "name": "google-maps-clone",
 "version": "0.1.0",
 "private": true,
 "dependencies": {
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
  "extends": [
      "react-app",
      "react-app/jest"
   ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
anauzrmj

anauzrmj1#

尝试删除package-lock.json
删除此文件后,使用npm install命令。

r1zhe5dt

r1zhe5dt2#

我发现错误我有多个package.json文件没有放置在正确的位置

waxmsbnn

waxmsbnn3#

在我的情况下,问题是npm是使用runas:/user/Administrator安装的管理员权限,但因为这个npm是安装在漫游的管理员用户。为了解决这个问题,我安装了npm在我的用户帐户。然后运行sudo npx create-react-app <name>命令。然后它的工作。我认为这可能也是你的问题。希望它有帮助。

相关问题