1

I want to build a website using React witht he help of npm and webpack. I have installed npm in my machine and now I am trying to install webpack in my machine. I ran the following command:

npm i webpack -S

but then it throws error. Please find the error log below:

npm http 200 https://registry.npmjs.org/is-buffer
npm http GET https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz
npm http 200 https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz

> uglifyjs-webpack-plugin@0.4.6 postinstall /usr/local/litle-home/tkale/cvs/scurvyReact/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js


module.js:340
    throw err;
          ^
Error: Cannot find module 'sync-exec'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/litle-home/tkale/cvs/scurvyReact/node_modules/webpack/node_modules/uglifyjs-webpack-plugin/lib/post_install.js:9:14)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
npm ERR! weird error 8
npm ERR! Error: ENOENT, open '/usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423156518-0.5044926188420504/package/fp/wrapperValue.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 2.6.32-696.10.2.el6.x86_64
npm ERR! command "node" "/usr/bin/npm" "i" "webpack" "-S"
npm ERR! cwd /usr/local/litle-home/tkale/cvs/scurvyReact
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR! path /usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423156518-0.5044926188420504/package/fp/wrapperValue.js
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! tar pack Error reading /usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423163147-0.8487295310478657/package
npm ERR! addLocalDirectory Could not pack "/usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423163147-0.8487295310478657/package" to "/usr/local/litle-home/tkale/.npm/es5-ext/0.10.35/package.tgz"
npm ERR! Error: ENOENT, lstat '/usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423153445-0.9213839254807681/package/node_modules/ajv/dist/regenerator.min.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 2.6.32-696.10.2.el6.x86_64
npm ERR! command "node" "/usr/bin/npm" "i" "webpack" "-S"
npm ERR! cwd /usr/local/litle-home/tkale/cvs/scurvyReact
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR! path /usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423153445-0.9213839254807681/package/node_modules/ajv/dist/regenerator.min.js
npm ERR! fstream_path /usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423153445-0.9213839254807681/package/node_modules/ajv/dist/regenerator.min.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /usr/local/litle-home/tkale/cvs/scurvyReact/npm-debug.log
npm ERR! not ok code 0

Incase it helps, also find package.json file below:

{
  "name": "React",
  "version": "1.0.0",
  "description": "Building website using React with help of npm and webpack",
  "main": "index.js",
  "scripts": {
    "test": "karma start",
    "start": "node server.js",
    "_comment": "start in the above line tells heroku how to start our app"
  },
  "author": "Tushar",
  "license": "XYZ"
}

Could you please help me solve this issue.

Tushar
  • 129
  • 1
  • 2
  • 10
  • Don´t know anything about webpack. But did you try `npm install -g sync-exec`? – teldri Oct 19 '17 at 14:52
  • yeah, I tried that but it didn't worked. – Tushar Oct 19 '17 at 15:04
  • Got the foll error: npm ERR! Error: EACCES, mkdir '/usr/lib/node_modules/sync-exec' npm ERR! { [Error: EACCES, mkdir '/usr/lib/node_modules/sync-exec'] npm ERR! errno: 3, npm ERR! code: 'EACCES', npm ERR! path: '/usr/lib/node_modules/sync-exec', npm ERR! fstream_type: 'Directory', npm ERR! fstream_path: '/usr/lib/node_modules/sync-exec', npm ERR! fstream_class: 'DirWriter', npm ERR! fstream_stack: npm ERR! [ '/usr/lib/node_modules/fstream/lib/dir-writer.js:36:23', npm ERR! '/usr/lib/node_modules/mkdirp/index.js:37:53', – Tushar Oct 19 '17 at 15:10
  • You might wanna have a look at this question since there seems to be something wrong with your permissions or you´re using the wrong user to install nmp modules...https://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo – teldri Oct 19 '17 at 15:53

1 Answers1

0

If I read the error correctly, you seem to be using a really old version of node and npm. Try updating those to the LTS or even the latest release.

You can get the latest versions and/or installation instructions here.

Rico Herwig
  • 1,672
  • 14
  • 23