我知道之前有人问过她这个问题,但我试过任何我能找到的解决方案,但仍然一无所获。我下载了一个项目组合模板,该模板在npm start上运行良好,直到过去几天我收到以下错误:
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/justinlengvarsky/Desktop/Personal Portfolio/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/justinlengvarsky/Desktop/Personal Portfolio/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 然后,我尝试执行git init,但收到一个错误,指出我的json文件中没有启动脚本。当我添加启动脚本时,我收到以下错误:
npm ERR! Failed at the personal-portfolio@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?这是我的package.json:
{
"name": "personal-portfolio",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node your-script.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/LengvarskyJ/personal-portfolio.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/LengvarskyJ/personal-portfolio/issues"
},
"homepage": "https://github.com/LengvarskyJ/personal-portfolio#readme"
}任何帮助都将不胜感激!
发布于 2021-11-23 13:48:16
我所能想到的就是尝试删除package.json文件、node_modules和.git文件夹,并重新初始化所有内容(npm init --y并添加所有依赖项)和git。然后重试。
此外,如果这不起作用,只需尝试更新/重新安装节点。可能您的npm安装中的某些内容配置不正确。
https://stackoverflow.com/questions/70082018
复制相似问题