![](/img/trans.png)
[英]NPM START ERROR - This is related to npm not being able to find a file
[英]npm not being able to find a file
我目前正在嘗試按照有關如何制作谷歌地圖克隆的教程進行操作,現在我已經完成了構建,然后我嘗試運行 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"
]
}
}
嘗試刪除package-lock.json
。
刪除此文件后,使用npm install
命令。
我發現錯誤我有多個 package.json 文件沒有放在正確的位置
在我的例子中,問題是 npm 是使用 runas:/user/Administrator 為管理員權限安裝的,但因此 npm 是在管理員用戶的漫游中安裝的。 為了解決這個問題,我在我的用戶帳戶中安裝了 npm。 然后運行sudo npx create-react-app <name>
命令。 然后它起作用了。 我想這也可能是你的問題。 希望能幫助到你。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.