jeudi 25 juin 2020

How to change the default package.json location in npm?

I have a TestCafe test project. This is the "scripts" portion of package.json:

  "scripts": {
    "test": "testcafe chrome tests"
  }

When I try to run the npm script, this is what I get:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'test'
1 verbose cli ]
2 info using npm@6.13.1
3 info using node@v13.3.0
4 verbose stack Error: ENOENT: no such file or directory, open 'E:\package.json'
5 verbose cwd E:\
6 verbose Windows_NT 10.0.18362
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
8 verbose node v13.3.0
9 verbose npm  v6.13.1
10 error code ENOENT
11 error syscall open
12 error path E:\package.json
13 error errno -4058
14 error enoent ENOENT: no such file or directory, open 'E:\package.json'
15 error enoent This is related to npm not being able to find a file.
16 verbose exit [ -4058, true ]

So, it is complaining about not finding E:\package.json which is true, because my project is in E:\projectName\.

How can I tell the npm to look for package.json in E:\projectName\package.json? How come it is not searching for it inside the project folder by default?

Aucun commentaire:

Enregistrer un commentaire