javascript - npm 找不到文件

标签 javascript reactjs npm

我目前正在尝试遵循有关如何克隆谷歌地图的教程,现在我已经完成了构建,然后我尝试运行 npm start 命令,但当我这样做时,我收到以下错误:

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"
    ]
  }
}

最佳答案

尝试删除package-lock.json

删除此文件后,使用npm install命令。

关于javascript - npm 找不到文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69497500/

相关文章:

javascript - 如何在动态列表中设置初始值?

javascript - 在应用程序打包的本地页面上启用 Electron 中的 nodeIntegration 是否安全?

javascript - 初始化后添加更多图像时,React-slick slider 会变形

reactjs - 不要在某些路线上渲染某些组件

python - 使用 npm-install --save 时出现错误 : Can't find Python executable . ..(系统变量已设置 python)

Javascript - 将图像发布到 Twitter,不重复

javascript - 防止空白输入不起作用

javascript - 防止孤儿

node.js - 无法在Azure应用程序服务上部署React JS应用程序

node.js - NPM 在 Windows 10 上启动时 NODE_PATH 抛出错误