就在Heroku上部署的应用程序已经过时纱锁定文件错误
我已经成功地签署了在Heroku上,但是当我git push
就跑app,它说
Application error. An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
于是,我去了Heroku的从Web浏览器和“手动部署”下,我点击“部署分公司”,并得到错误的这份名单:
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
engines.yarn (package.json): unspecified (use default)
Resolving node version 10.x...
Downloading and installing node 10.15.1...
Using default npm version: 6.4.1
Resolving yarn version 1.x...
Downloading and installing yarn (1.14.0)...
Installed yarn 1.14.0
-----> Building dependencies
Installing node modules (yarn.lock)
yarn install v1.14.0
[1/4] Resolving packages...
error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`.
info Visit for documentation about this command.
-----> Build failed
! Outdated Yarn lockfile
Your application contains a Yarn lockfile (yarn.lock) which does not
match the dependencies in package.json. This can happen if you use npm
to install or update a dependency instead of Yarn.
Please run the following command in your application directory and check
in the new yarn.lock file:
$ yarn install
$ git add yarn.lock
$ git commit -m "Updated Yarn lockfile"
$ git push heroku master
! Push rejected, failed to compile Node.js app.
! Push failed
有人可以给我一些指点?我不知道为什么它提到纱。这里是我的package.json:
{
"name": "tictacttoe",
"version": "0.1.0",
"private": true,
"engines": {
"node": "v10.13.0",
"npm": "6.4.1"
},
"dependencies": {
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-scripts": "2.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"webpack": "^4.19.1",
"webpack-dev-server": "^3.1.14"
}
}
回答如下:
我不知道这是否是因为Heroku上或在您的最终一些错误配置的...但基本上Heroku的运行yarn
安装你的依赖,因为你没有一个yarn.lock
(或有一个过时的一个),它是导致一个错误。
试试你的系统上安装全球纱线和运行在你的项目的根目录纱。在此之后,如果你提交yarn.lock
文件它可能工作。
据我所知,Heroku的检测从您是否有它的yarn.lock
和package-lock.json
你的包管理器。所以,你应该将其删除yarn.lock
,或通过运行在你的项目的根目录yarn
更新。