'NPM install cannot find package.json
I configured a workflow on Github and while running npm install it gives this error:
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.
As I understand this error implies that the npm install command cannot find the package.json file, however, I checked and package.json is visible in my project.
How can I solve this problem?
This is the .yml file I created
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
Solution 1:[1]
run npm init command to create package.json
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | remote007 |
