-2

I'm on ubuntu 20.04.4 LTS. I'm trying to install locally a react project.

I tried to clone de repo from github, and install locally the react app, doing this :

git clone https://github.com/OpenClassrooms-Student-Center/7008001-Debutez-avec-React.git

then

npm install --verbose

But it just won't work. this is the output :

npm verb cli   '/home/lblk/.nvm/versions/node/v17.6.0/bin/node',
npm verb cli   '/home/lblk/.nvm/versions/node/v17.6.0/bin/npm',
npm verb cli   'install',
npm verb cli   '--verbose'
npm verb cli ]
npm info using npm@8.5.1
npm info using node@v17.6.0
npm timing npm:load:whichnode Completed in 0ms
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:/home/lblk/.nvm/versions/node/v17.6.0/lib/node_modules/npm/npmrc Completed in 0ms
npm timing config:load:builtin Completed in 1ms
npm timing config:load:cli Completed in 2ms
npm timing config:load:env Completed in 0ms
npm timing config:load:file:/home/lblk/Documents/dev/javascript/7008001-Debutez-avec-React/.npmrc Completed in 0ms
npm timing config:load:project Completed in 16ms
npm timing config:load:file:/home/lblk/.npmrc Completed in 0ms
npm timing config:load:user Completed in 0ms
npm timing config:load:file:/home/lblk/.nvm/versions/node/v17.6.0/etc/npmrc Completed in 0ms
npm timing config:load:global Completed in 1ms
npm timing config:load:validate Completed in 0ms
npm timing config:load:credentials Completed in 2ms
npm timing config:load:setEnvs Completed in 1ms
npm timing config:load Completed in 26ms
npm timing npm:load:configload Completed in 26ms
npm timing npm:load:setTitle Completed in 0ms
npm timing config:load:flatten Completed in 3ms
npm timing npm:load:display Completed in 8ms
npm verb logfile /home/lblk/.npm/_logs/2022-03-18T11_07_46_273Z-debug-0.log
npm timing npm:load:logFile Completed in 7ms
npm timing npm:load:timers Completed in 0ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load Completed in 43ms
npm timing arborist:ctor Completed in 1ms
npm timing idealTree:init Completed in 11ms
npm timing idealTree:userRequests Completed in 0ms
npm timing idealTree:#root Completed in 0ms
npm timing idealTree:buildDeps Completed in 2ms
npm timing idealTree:fixDepFlags Completed in 0ms
npm timing idealTree Completed in 15ms
npm timing reify:loadTrees Completed in 16ms
npm timing reify:diffTrees Completed in 1ms
npm timing reify:retireShallow Completed in 1ms
npm timing reify:createSparse Completed in 0ms
npm timing reify:loadBundles Completed in 0ms
npm timing reify:audit Completed in 1ms
npm timing reify:unpack Completed in 0ms
npm timing reify:unretire Completed in 0ms
npm timing build:queue Completed in 0ms
npm timing build:deps Completed in 1ms
npm timing build Completed in 1ms
npm timing reify:build Completed in 1ms
npm timing reify:trash Completed in 0ms
npm timing reify:save Completed in 1ms
npm timing reify Completed in 39ms
npm timing command:install Completed in 41ms
npm verb stack Error: ENOENT: no such file or directory, open '/home/lblk/Documents/dev/javascript/7008001-Debutez-avec-React/package.json'
npm verb cwd /home/lblk/Documents/dev/javascript/7008001-Debutez-avec-React
npm verb Linux 5.13.0-35-generic
npm verb argv "/home/lblk/.nvm/versions/node/v17.6.0/bin/node" "/home/lblk/.nvm/versions/node/v17.6.0/bin/npm" "install" "--verbose"
npm verb node v17.6.0
npm verb npm  v8.5.1
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/lblk/Documents/dev/javascript/7008001-Debutez-avec-React/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/lblk/Documents/dev/javascript/7008001-Debutez-avec-React/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm verb exit -2
npm timing npm Completed in 302ms
npm verb code -2

npm ERR! A complete log of this run can be found in:

I searched a while but I just don't understand... As you might have understood from the repo I'm trying to install, I am learning coding and react :)

Thanks for your help

Lebelek
  • 1
  • 2
  • do you have an installed Node.js Version? – mmh4all Mar 18 '22 at 11:24
  • Can you specify what you’re trying to run? There’s no package.json file here https://github.com/OpenClassrooms-Student-Center/7008001-Debutez-avec-React edit: oops that’s the error… you cant install node modules without a package.json –  Mar 18 '22 at 11:25
  • Master branch does not include a node project. You must change the branch as shown tables in the readme, e.g. [Branche begin](https://github.com/OpenClassrooms-Student-Center/7008001-Debutez-avec-React/tree/P2C2-Begin) – fukit0 Mar 18 '22 at 11:39

2 Answers2

4

Change your branch to one of the assignment ones like: https://github.com/OpenClassrooms-Student-Center/7008001-Debutez-avec-React/tree/P2C2-Begin

You current branch does not have a package.json file like the error says and therefore you cant install node modules

  • Hello @Lebelek, if you found this helpful, please confirm this question has been answered. You can accept one answer (again, if it helps you) by clicking on the big gray check button on its left side. If you wish you can add +10 points to any author of a good answer, click the upper gray triangle and the points will be awarded accordingly. –  Mar 18 '22 at 12:38
  • Hi Joe ! It worked doing as you suggested. However, now I am trying to do ```npm start``` and I get an error : ```node:internal/modules/cjs/loader:488``` I tried this : https://stackoverflow.com/questions/53545800/internal-modules-cjs-loader-js582-throw-err but it doesn't change anything. – Lebelek Mar 18 '22 at 13:57
  • @Lebelek did you run ``npm install`` first? –  Mar 18 '22 at 14:05
  • yes, this is the output of `npm install` : `up to date, audited 1848 packages in 10s 124 packages are looking for funding run npm fund for details 45 vulnerabilities (26 moderate, 18 high, 1 critical) To address issues that do not require attention, run: npm audit fix To address all issues (including breaking changes), run: npm audit fix --force Run npm audit for details.` – Lebelek Mar 21 '22 at 08:51
  • Ok, I did `nvm use 16` and now `npm start`works ! I found the idea in this topic : https://stackoverflow.com/questions/70199762/errorr-in-nodeinternal-modules-cjs-loader488 – Lebelek Mar 21 '22 at 09:37
0

You should do

npm init

in the root of your project. It'll create package.json file, among other things. Then you can use npm install

Dmitriy Zhiganov
  • 1,060
  • 1
  • 5
  • 14