最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - npm not being able to find a file - Stack Overflow

programmeradmin2浏览0评论

I am currently trying to follow a tutorial on how to make a google maps clone and I am now done with the build I then tried to run the npm start mand but when I do I get the following errors:

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

I a have already tried to clear my cache by running the mand npm cache clean and then run npm start but I still get the same errors is there anybody that has run into the same errors and found a solution?

here the link to the tutorial:

here is the package.json file:

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

I am currently trying to follow a tutorial on how to make a google maps clone and I am now done with the build I then tried to run the npm start mand but when I do I get the following errors:

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

I a have already tried to clear my cache by running the mand npm cache clean and then run npm start but I still get the same errors is there anybody that has run into the same errors and found a solution?

here the link to the tutorial: https://javascript.plainenglish.io/build-a-google-maps-clone-in-less-than-20-minutes-6f7c68db13e

here is the package.json file:

{
 "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"
    ]
  }
}
Share asked Oct 8, 2021 at 14:27 user17099166user17099166
Add a ment  | 

3 Answers 3

Reset to default 1

Try to delete package-lock.json.

After deleting this file use the npm install mand.

In my case, the issue was npm was installed using runas :/user/Administrator for admin privileges but because of this npm was installed in Roaming of Administrator user. To fix this issue I installed npm in my user account. Then run sudo npx create-react-app <name> mand. Then it worked. I think this might also be your issue. Hope it helps.

I found the error i had multiple package.json files that werent placed in the right places

发布评论

评论列表(0)

  1. 暂无评论