Reputation: 1
As the title states, attempting to run npm init
with or without the --force flag does not create a file a package.json.
I've seen this previous post: npm init doesn't create package.json
As a previous post had indicated, of course it can't open the file, it hasn't created one.
Context:
As mentioned above:node v20.6.1, npm v10.1.0
C:\Windows\system32>where node
C:\Program Files\nodejs\node.exe
C:\Windows\system32>where npm
C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd
C:\Users\kiera\AppData\Roaming\npm\npm
C:\Users\kiera\AppData\Roaming\npm\npm.cmd
I am attempting to run:
PS C:\Users\kiera\Documents\GitHub\portfoliov1> npm init -f
npm WARN using --force Recommended protections disabled.
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\kiera\Documents\GitHub\portfoliov1\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\kiera\Documents\GitHub\portfoliov1\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: C:\Users\kiera\AppData\Local\npm-cache\_logs\2023-09-19T15_48_44_417Z-debug-0.log
PS C:\Users\kiera\Documents\GitHub\portfoliov1>
The debug logs are as follows:
0 verbose cli C:\Program Files\nodejs\node.exe C:\Users\kiera\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Users\kiera\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:C:\Users\kiera\Documents\GitHub\portfoliov1\.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:C:\Users\kiera\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Users\kiera\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:setEnvs Completed in 1ms
16 timing config:load Completed in 8ms
17 timing npm:load:configload Completed in 8ms
18 timing config:load:flatten Completed in 2ms
19 timing npm:load:mkdirpcache Completed in 0ms
20 timing npm:load:mkdirplogs Completed in 1ms
21 verbose title npm init
22 verbose argv "init" "--force"
23 timing npm:load:setTitle Completed in 0ms
24 timing npm:load:display Completed in 1ms
25 verbose logfile logs-max:10 dir:C:\Users\kiera\AppData\Local\npm-cache\_logs\2023-09-19T15_48_44_417Z-
26 verbose logfile C:\Users\kiera\AppData\Local\npm-cache\_logs\2023-09-19T15_48_44_417Z-debug-0.log
27 timing npm:load:logFile Completed in 6ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 warn using --force Recommended protections disabled.
31 timing npm:load Completed in 38ms
32 silly logfile start cleaning logs, removing 2 files
33 silly logfile done cleaning log files
34 timing command:init Completed in 17ms
35 verbose stack Error: ENOENT: no such file or directory, open 'C:\Users\kiera\Documents\GitHub\portfoliov1\package.json'
36 verbose cwd C:\Users\kiera\Documents\GitHub\portfoliov1
37 verbose Windows_NT 10.0.19045
38 verbose node v20.6.1
39 verbose npm v10.1.0
40 error code ENOENT
41 error syscall open
42 error path C:\Users\kiera\Documents\GitHub\portfoliov1\package.json
43 error errno -4058
44 error enoent ENOENT: no such file or directory, open 'C:\Users\kiera\Documents\GitHub\portfoliov1\package.json'
45 error enoent This is related to npm not being able to find a file.
45 error enoent
46 verbose exit -4058
47 timing npm Completed in 340ms
48 verbose code -4058
49 error A complete log of this run can be found in: C:\Users\kiera\AppData\Local\npm-cache\_logs\2023-09-19T15_48_44_417Z-debug-0.log
Advice and insight welcome. As mentioned previously, I have re-installed node and npm multiple times with no difference. I have run the commands with and without Admin privileges.
I'm not having great luck on my first stint back on windows development :').
As suggested, I have attempted with -y
and -y -f
.
C:\Users\kiera\Documents\GitHub\portfoliov1>npm init -y
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\kiera\Documents\GitHub\portfoliov1\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\kiera\Documents\GitHub\portfoliov1\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: C:\Users\kiera\AppData\Local\npm-cache\_logs\2023-09-19T18_09_09_225Z-debug-0.log
C:\Users\kiera\Documents\GitHub\portfoliov1>npm init -y -f
npm WARN using --force Recommended protections disabled.
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\kiera\Documents\GitHub\portfoliov1\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\kiera\Documents\GitHub\portfoliov1\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
Upvotes: 0
Views: 43