Current Behavior:
Sorry for the ridiculously long title, I couldn’t find a way to distill it into fewer words.
This may not be a bug, but it’s certainly unexpected behavior.
Basically, when you install packages in a folder without a package.json, some basic auditing happens at the end. I see «Found vulnerabilities (<y> low, <z> moderate, <α> high, <β> critical». However, if I then do an audit myself (npm audit
or npm audit fix
), I get the title error, Cannot audit a project without a package.json
.
Expected Behavior:
Either:
npm audit
works with apackage-lock.json
, regardless of the existence ofpackage.json
, ornpm audit
doesn’t happen duringnpm install
, or- Some warning during the installation audit saying something like «We weren’t able to produce an accurate auditing, but this is an approximate one:»
I suggest 1, for obvious reasons.
Steps To Reproduce:
mkdir test/
cd test/
npm install posthtml // "found 572 vulnerabilities..."
npm audit // "Cannot audit a project without a package.json"
Environment:
OS: Ubuntu 20.04
node -v: v14.5.0
npm -v: 6.14.7
I ran npx create-react-app react-app
in cmd and though it created the app in this directory but it was not fully installed. 59 packages are looking for funding
it says. I tried to npm start
but it says D:ReactJsreact-app>npm start
npm ERR! missing script: start
The full error message is :
D:ReactJs>npx create-react-app react-app
Creating a new React app in D:ReactJsreact-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
> core-js@2.6.11 postinstall D:ReactJsreact-appnode_modulesbabel-runtimenode_modulescore-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js@3.6.5 postinstall D:ReactJsreact-appnode_modulescore-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js-pure@3.6.5 postinstall D:ReactJsreact-appnode_modulescore-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
+ react-dom@16.13.1
+ react-scripts@3.4.1
+ react@16.13.1
added 1612 packages from 750 contributors and audited 921729 packages in 728.54s
59 packages are looking for funding
run `npm fund` for details
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.
D:ReactJs> npm audit fix
npm ERR! code EAUDITNOPJSON
npm ERR! audit No package.json found: Cannot audit a project without a package.json
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersAhnaaf Al RafeeAppDataRoamingnpm-cache_logs2020-05-10T20_44_56_644Z-debug.log
D:ReactJs>cd react-app
D:ReactJsreact-app>npm start
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersAhnaaf Al RafeeAppDataRoamingnpm-cache_logs2020-05-10T20_46_12_290Z-debug.log
asked May 10, 2020 at 20:54
1
You should remove global version of create-react-app script npm uninstall -g create-react-app
and then use npx create-react-app react-app
again.
It should work.
answered May 10, 2020 at 21:21
Denis StukalovDenis Stukalov
1,2061 gold badge6 silver badges11 bronze badges
2
When up-grading my Tutanota e-mail Linux client, I’ve found some errors, possible vulneralbilities.
added 912 packages from 511 contributors and audited 985 packages in 26.881s
16 packages are looking for funding
run `npm fund` for details
found 81 vulnerabilities (79 low, 2 high)
run `npm audit fix` to fix them, or `npm audit` for details
I’m not very familiar with Node.js, so I just tried to use the above commands
npm audit
npm ERR! code EAUDITNOPJSON
npm ERR! audit No package.json found: Cannot audit a project without a package.json
npm ERR! A complete log of this run can be found in:
npm ERR! /home/zbyszek/.npm/_logs/2020-07-01T06_05_55_221Z-debug.log
npm audit fix
npm ERR! code EAUDITNOPJSON
npm ERR! audit No package.json found: Cannot audit a project without a package.json
npm ERR! A complete log of this run can be found in:
npm ERR! /home/zbyszek/.npm/_logs/2020-07-01T06_00_14_635Z-debug.log
The above mentioned debug log contains this
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'audit', 'fix' ]
2 info using npm@6.14.5
3 info using node@v14.5.0
4 verbose config Skipping project config: /home/zbyszek/.npmrc. (matches userconfig)
5 verbose npm-session ea92819d9b8544c0
6 verbose stack Error: No package.json found: Cannot audit a project without a package.json
6 verbose stack at /usr/lib/node_modules/npm/lib/audit.js:164:19
6 verbose stack at tryCatcher (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
6 verbose stack at Promise._settlePromiseFromHandler (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:514:35)
6 verbose stack at Promise._settlePromise (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:574:18)
6 verbose stack at Promise._settlePromise0 (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:619:10)
6 verbose stack at Promise._settlePromises (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:699:18)
6 verbose stack at Promise._fulfill (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:643:18)
6 verbose stack at PromiseArray._resolve (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise_array.js:126:19)
6 verbose stack at PromiseArray._promiseFulfilled (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise_array.js:144:14)
6 verbose stack at PromiseArray._iterate (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise_array.js:114:31)
6 verbose stack at PromiseArray.init [as _init] (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise_array.js:78:10)
6 verbose stack at Promise._settlePromise (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:571:21)
6 verbose stack at Promise._settlePromise0 (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:619:10)
6 verbose stack at Promise._settlePromises (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:699:18)
6 verbose stack at Promise._fulfill (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:643:18)
6 verbose stack at PromiseArray._resolve (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise_array.js:126:19)
7 verbose cwd /home/zbyszek
8 verbose Linux 5.7.6-arch1-1
9 verbose argv "/usr/bin/node" "/usr/bin/npm" "audit" "fix"
10 verbose node v14.5.0
11 verbose npm v6.14.5
12 error code EAUDITNOPJSON
13 error audit No package.json found: Cannot audit a project without a package.json
14 verbose exit [ 1, true ]
Is it something I should be worried with oraz just skip it?
Last edited by Zibi1981 (2020-07-01 06:10:58)
«… being a Linux user is sort of like living in a house inhabited by a large family of carpenters and architects. Every morning when you wake up, the house is a little different. Maybe there is a new turret, or some walls have moved. Or perhaps someone has temporarily removed the floor under your bed.»
MSI GT75 Titan 8RG