18

I am trying to run npm run locally, and ran npm init, that created package.json. Here is my package.json

    "name": "ironic-ui",
    "version": "1.0.0",
    "description": "======================== Team and repository tags    ========================",
    "main": "test-shim.js",
    "directories": {
    "doc": "doc"
   },
    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
   },
    "repository": {
    "type": "git",
    "url": "https://git.openstack.org/openstack/ironic-ui"
  },
    "author": "",
    "license": "ISC"
 }

Is there missing something? Or do i need to install something more? I am getting an error "Missing script: lint" Thanks

user3339691
  • 455
  • 2
  • 5
  • 16

9 Answers9

15

You need to setup linter and add lint command in your package.json Many linter are available. Assuming you setup eslint https://www.npmjs.com/package/eslint

it would look something like this

// package.json
{ 
  //...
  "scripts": {
    "lint": "eslint.js"
  }
}
roxxypoxxy
  • 2,973
  • 1
  • 21
  • 28
12

Add this script to your package.json file: "lint": "./node_modules/.bin/eslint ."

mafiurs
  • 141
  • 2
  • 6
8

Should not be removing eslint, instead should try to configure it to make it work to your preferences.

However, if you need to remove it because of time or other constraint

  1. From firebase.json delete "npm --prefix \"$RESOURCE_DIR\" run lint"
  2. From Package.json delete "lint": "eslint .", (should be within the scripts:)
  3. Also from Package.json delete these devDependencies
"eslint": "^7.6.0",
"eslint-config-google": "^0.14.0"`
  1. Delete this file from repo `.eslintrc.js
  2. Then run npm i

then you should be able to run firebase deploy

iDecode
  • 22,623
  • 19
  • 99
  • 186
Jonathan Sanchez
  • 7,316
  • 1
  • 24
  • 20
7

If you want to remove eslint from your Firebase Functions project, you can go to firebase.json and delete the line npm --prefix \"$RESOURCE_DIR\" run lint (inside predeploy). After this, you can delete the .eslintrc.json file inside your functions project

Rodrigo João Bertotti
  • 5,179
  • 2
  • 23
  • 34
5

I got the same problem.

I deleted functions folder, .firebaserc and firebase.json.

Then reinstalled firebase-tools

npm install -g firebase-tools

After firebase init, chose functions, it asked

Do you want to use ESLint to catch probable .....?.

I typed No.

It worked fine for me.

TsaiKoga
  • 12,914
  • 2
  • 19
  • 28
phone mhan
  • 51
  • 1
  • 2
1

I ran into this issue when after setting up a firebase functions project inside a project that already had a firebase function elsewhere. It seems that firebase init doesn't necessarily know which project to set as "source" in firebase.json.

In my case, firebase.json simply pointed to the wrong source dir. I corrected it to point the my intended directory - issue solves.

Note: In my case, linting was desired, so removing linting was not the solution.

Jefftopia
  • 2,105
  • 1
  • 26
  • 45
0

I get the exact same problem when I do: firebase deploy --only functions (-- only functions is optional), it redirects me to

npm --prefix %RESOURCE_DIR% run lint

It worked fine for me when I removed lint, thus having:

npm --prefix %RESOURCE_DIR% run

only.

Ziad
  • 63
  • 1
  • 9
0

For me i was just running the command without entering the function folder so it was not finding it i was just running this function on the project folder. So run cd function in your cmd if your are just in the project folder then run the command again but if the script is not in your package.json as mentioned above or you said no to eslint/lint when you initialized your firebase project lint wont work but others command that exist in your scripts work.

Abrham Daniel
  • 47
  • 1
  • 4
0

Editing package.json from "lint": "eslint .", to "lint": "eslint", worked for me.

Axisnix
  • 2,822
  • 5
  • 19
  • 41