感谢您的帮助。我只有一个想要通过netlify托管的简单html文件。我的git,index.html,style.css和自述文件中有三个文件。
html文件就是
<!DOCTYPE html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<link href="style.css" rel="stylesheet" type="text/css">
<title>Company</title>
</head>
<body>
<div>
<h1> Coming Soon...</h1>
</div>
</body>
</html>
,CSS文件为:
h1 {
text-align: center;
font-size: 20pt;
color: #000099;
margin-bottom: 5px;
}
我得到的错误是:
10:45:42 PM: Executing user command: npm run build
10:45:43 PM: npm
10:45:43 PM: ERR!
10:45:43 PM: code
10:45:43 PM: ENOENT
10:45:43 PM: npm ERR!
10:45:43 PM: syscall open
10:45:43 PM: npm ERR! path /opt/build/repo/package.json
10:45:43 PM: npm
10:45:43 PM: ERR!
10:45:43 PM: errno
10:45:43 PM: -2
10:45:43 PM: npm
10:45:43 PM: ERR! enoent ENOENT: no such file or directory, open '/opt/build/repo/package.json'
10:45:43 PM: npm ERR! enoent
10:45:43 PM: This is related to npm not being able to find a file.
10:45:43 PM: npm ERR! enoent
10:45:43 PM: npm ERR!
10:45:43 PM: A complete log of this run can be found in:
10:45:43 PM: npm ERR! /opt/buildhome/.npm/_logs/2019-10-23T02_45_43_136Z-debug.log
10:45:43 PM: Skipping functions preparation step: no functions directory set
10:45:43 PM: Caching artifacts
10:45:43 PM: Started saving pip cache
10:45:43 PM: Finished saving pip cache
10:45:43 PM: Started saving emacs cask dependencies
10:45:43 PM: Finished saving emacs cask dependencies
10:45:43 PM: Started saving maven dependencies
10:45:43 PM: Finished saving maven dependencies
10:45:43 PM: Started saving boot dependencies
10:45:43 PM: Finished saving boot dependencies
10:45:43 PM: Started saving go dependencies
10:45:43 PM: Finished saving go dependencies
10:45:46 PM: Error running command: Build script returned non-zero exit code: 254
10:45:46 PM: Failing build: Failed to build site
10:45:46 PM: failed during stage 'building site': Build script returned non-zero exit code: 254
10:45:46 PM: Finished processing build request in 13.711952891s
答案 0 :(得分:0)
相关部分是:
ERR! enoent ENOENT: no such file or directory, open '/opt/build/repo/package.json'
npm ERR! enoent
This is related to npm not being able to find a file.
确保执行create a package.json
first。
npm init
应该照顾好它。