繁体   English   中英

NPM安装找不到package.json

[英]NPM install cannot find package.json

我在 Github 上配置了一个工作流,在运行npm install时出现了这个错误:

npm WARN saveError ENOENT: no such file or directory, open '/home/runner/work/project/project/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/runner/work/project/project/package.json'
npm WARN restaurateur No description
npm WARN restaurateur No repository field.
npm WARN restaurateur No README data
npm WARN restaurateur No license field.

据我了解,此错误意味着npm install命令找不到package.json文件,但是,我检查了一下, package.json在我的项目中可见。

我怎么解决这个问题?

这是我创建的.yml文件

name: project-folder

on:
  push:
    paths: project-folder**
    branches: [main]
  pull_request:
    paths: project-folder/**
    branches: [main]
  
jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [10.x, 12.x, 14.x, 15.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    
    - name: Install dependencies
      run: npm install

    - name: Run the tests
      run: npm test

    - name: Build
      run: npm run build

运行 npm init 命令创建 package.json

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM