kentcdodds/testing-react-apps

Error running `npm install`

weelillad opened this issue · 6 comments

My environment: elementary OS Juno 64-bit (based on Ubuntu LTS 18.04)

➜  react-testing-workshop git:(master) node --version
v11.13.0
➜  react-testing-workshop git:(master) npm --version
6.7.0

Error message

➜  react-testing-workshop git:(master) sudo npm install

> node@10.15.3 preinstall /home/andy/Workshops/react-testing-workshop/node_modules/node
> node installArchSpecificPackage

Unhandled rejection Error: EACCES: permission denied, open '/home/andy/.npm/_cacache/tmp/df60ebfc'

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/andy/.npm/_logs/2019-04-09T15_15_12_096Z-debug.log
module.js:549
    throw err;
    ^

Error: Cannot find module 'node-linux-x64/package.json'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.resolve (internal/module.js:18:19)
    at ChildProcess.<anonymous> (/home/andy/Workshops/react-testing-workshop/node_modules/node-bin-setup/index.js:18:27)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
npm WARN eslint-config-react-app@3.0.8 requires a peer of babel-eslint@9.x but none is installed. You must install peer dependencies yourself.
npm WARN ts-pnp@1.0.1 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/react-scripts/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node@10.15.3 preinstall: `node installArchSpecificPackage`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node@10.15.3 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/andy/.npm/_logs/2019-04-09T15_15_13_100Z-debug.log

Hmmmm... This is pretty odd. Do you normally have to run npm install with sudo? If so, I recommend you do this: https://stackoverflow.com/a/16151707/971592

Then try again.

Hmm, looks like the actual cause is cypress-testing-workshop/node_modules being owned by root instead of me. Now it succeeds, thanks for the help!

Not sure if this is related, because the next step also doesn't work..

➜  react-testing-workshop git:(master) npm run setup --silent                
🎉  Congrats! Your system is setup properly
You should be good to install and run things.
📦  Installing dependencies via npm install
🔑  starting install in /home/andy/Workshops/react-testing-workshop
removed 1 package and audited 43169 packages in 11.297s
found 63 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
🎉  finished installing dependencies in "/home/andy/Workshops/react-testing-workshop"
👍  all dependencies installed
sh: 1: npm-run-all: not found
➜  react-testing-workshop git:(master) npm run lint

> react-testing-workshop@1.0.0 lint /home/andy/Workshops/react-testing-workshop
> eslint .

sh: 1: eslint: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! react-testing-workshop@1.0.0 lint: `eslint .`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the react-testing-workshop@1.0.0 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/andy/.npm/_logs/2019-04-09T15_35_45_947Z-debug.log
➜  react-testing-workshop git:(master) npm run test:coverage

> react-testing-workshop@1.0.0 test:coverage /home/andy/Workshops/react-testing-workshop
> npm run test -- --coverage


> react-testing-workshop@1.0.0 test /home/andy/Workshops/react-testing-workshop
> react-scripts test --env=jsdom "--coverage"

sh: 1: react-scripts: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! react-testing-workshop@1.0.0 test: `react-scripts test --env=jsdom "--coverage"`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the react-testing-workshop@1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/andy/.npm/_logs/2019-04-09T15_37_40_525Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-testing-workshop@1.0.0 test:coverage: `npm run test -- --coverage`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the react-testing-workshop@1.0.0 test:coverage script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/andy/.npm/_logs/2019-04-09T15_37_40_566Z-debug.log

From the look of things, dependencies were not installed properly. I'd recommend starting over from scratch. I think it'll work now that you're npm is configured properly.

Yup it works now. Thanks for the help!

Hooray! See you soon!