简体   繁体   English

npm在用户目录中寻找package.json

[英]npm looking for package.json in user directory

I've just finished up writing a test suite, and after adding the test file to the npm scripts object in the local package.json, I appear to have warnings that the package.json cannot be found in the user directory. 我刚刚完成了一个测试套件的编写,并且将测试文件添加到本地package.json中的npm脚本对象之后,我似乎警告说在用户目录中找不到package.json。

npm ERR! path C:\Users\chris\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\chris\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\chris\AppData\Roaming\npm-cache\_logs\2018-08-04T16_59_06_479Z-debug.log 

Why is it going to the user directory instead of the current directory, which is C:\\Users\\chris\\Google Drive\\code projects\\firebase-form\\firebase-form? 为什么要转到用户目录而不是当前目录,即C:\\ Users \\ chris \\ Google Drive \\ code projects \\ firebase-form \\ firebase-form? Is it a problem with the script test command, which is "test": "mocha tests/firebase-listeners-tests.js"? 脚本测试命令“ test”是否存在问题:“ mocha tests / firebase-listeners-tests.js”?

i am running npm test from the local directory but nothing seems to be working. 我正在从本地目录运行npm test ,但似乎没有任何效果。 here is how i linked my test script in the package.json: "test": "tests/resources tests.js" 这是我在package.json中链接我的测试脚本的方式: "test": "tests/resources tests.js"

Also, for additional information here is my projects file structure: 另外,有关其他信息,这是我的项目文件结构:

firebase-form/
├── tests/
│   ├── firebase-listeners-tests.js
│   ├── resources tests.js
│   └── test_dependancy-fake_data_for_firebase.js
└── package.json 

As you can see I do not have an entry point .js file, but that's because I haven't wrapped up the testing yet. 如您所见,我没有入口点.js文件,但这是因为我还没有完成测试。

Also here is the repo link: https://github.com/LeviathanTheGreat/firebase-form 这里也是回购链接: https : //github.com/LeviathanTheGreat/firebase-form

fixed 固定

I had forgotten to put "node" in front of the file in the test command. 我忘记在测试命令中将“节点”放在文件前面。 as well I had changed the filename like @awesomeguy had suggested. 我也像@awesomeguy建议的那样更改了文件名。 But I had forgotten to change it in the package.json 但是我忘了在package.json中更改它

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

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