Npm install fail with the version is 3.1.1

I try to install grafana from source code, but error occurred when built the front-end assets,
the error is

node-pre-gyp ERR! Pre-built binaries not found for iltorb@1.3.1 and node@6.2.0 (node-v48 ABI) (falling back to source compile with node-gyp)

the compile also failed. I had to install node-pre-gyp globally with -g arg. And works
But when I run grunt build , it blocked in
Running “typescript:build” (typescript) task

Anyone can help me configure out for me

Can you paste in the whole error message, please. And provide some more details: which OS, node version, npm version

OS: CentOS 6.7
node: 4.4.0
npm: 2.15.0

npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN optional dep failed, continuing fsevents@1.1.1
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN optional dep failed, continuing fsevents@1.1.1
npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
 
> phantomjs-prebuilt@2.1.14 install /vagrant_data/workspace/grafana/src/github.com/grafana/grafana/node_modules/phantomjs-prebuilt
> node install.js

/vagrant_data/workspace/grafana/src/github.com/grafana/grafana/node_modules/phantomjs-prebuilt/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/certificate.js:57
Certificate.for
               

SyntaxError: Unexpected token ILLEGAL
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant_data/workspace/grafana/src/github.com/grafana/grafana/node_modules/phantomjs-prebuilt/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/fingerprint.js:10:19)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
npm WARN deprecated es6-module-loader@0.17.11: This project has been deprecated for "npm install es-module-loader" based on the newer loader spec.
npm WARN optional dep failed, continuing iltorb@1.3.1

> node-sass@3.13.1 install /vagrant_data/workspace/grafana/src/github.com/grafana/grafana/node_modules/grunt-sass/node_modules/node-sass
> node scripts/install.js


Killed

Then I run npm install phantomjs-prebuilt node-sass to install them.

but the grunt can’t execute normally,

Version 3.1.1
Loading "jscs.js" tasks...ERROR
>> SyntaxError: missing ) after argument list
Loading "sass-lint.js" tasks...ERROR
>> SyntaxError: Unexpected token ILLEGAL
Loading "compress.js" tasks...ERROR
>> SyntaxError: Unexpected token ILLEGAL
Loading "cssmin.js" tasks...ERROR
>> SyntaxError: Unexpected token ILLEGAL
Loading "htmlmin.js" tasks...ERROR
>> SyntaxError: Unexpected token ILLEGAL
Loading "jshint.js" tasks...ERROR
>> SyntaxError: missing ) after argument list
Loading "uglify.js" tasks...ERROR
>> SyntaxError: Unexpected identifier
Loading "grunt-karma.js" tasks...ERROR
>> SyntaxError: Unexpected token ILLEGAL
Loading "ng-annotate.js" tasks...ERROR
>> SyntaxError: Unexpected token ILLEGAL
Loading "sass.js" tasks...ERROR
>> Error: ENOENT: no such file or directory, scandir '/vagrant_data/workspace/grafana/src/github.com/grafana/grafana/node_modules/grunt-sass/node_modules/node-sass/vendor'
Loading "tslint.js" tasks...ERROR
>> SyntaxError: Unexpected token ILLEGAL
Loading "index.js" tasks...ERROR
>> SyntaxError: Unexpected token ILLEGAL
Loading "Gruntfile.js" tasks...ERROR
>> SyntaxError: Unexpected token ILLEGAL
Warning: Task "jscs" not found. Use --force to continue.

Aborted due to warnings.

Not sure at which step you got this error. Did you follow the steps in this section and then got the first error about phantom and node-sass when executing: yarn install --pure-lockfile ?

Yeah, But I just need install Grafana 3.1.1 because of out prod env using it. I tried using node 7.0, but still failed. Anyhow, I didn’t use yarn, but with npm install, according to this 3.1.x setion。Maybe you can give me some advice after trying to build this version. Thanks

Delete your node_modules directory and try running npm install again. If you get an error during npm install, can you paste that here. That is the real error that you need to solve to get it working.

But I had pasted the error in the former reply. The npm install error is:

npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN optional dep failed, continuing fsevents@1.1.1
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN optional dep failed, continuing fsevents@1.1.1
npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
 
> phantomjs-prebuilt@2.1.14 install /vagrant_data/workspace/grafana/src/github.com/grafana/grafana/node_modules/phantomjs-prebuilt
> node install.js

/vagrant_data/workspace/grafana/src/github.com/grafana/grafana/node_modules/phantomjs-prebuilt/node_modules/fs-extra/lib/remove/rimraf.js:131
          rmdir(p, options, er, 
                                

SyntaxError: Unexpected token ILLEGAL
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant_data/workspace/grafana/src/github.com/grafana/grafana/node_modules/phantomjs-prebuilt/node_modules/fs-extra/lib/remove/index.js:1:76)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
npm WARN deprecated es6-module-loader@0.17.11: This project has been deprecated for "npm install es-module-loader" based on the newer loader spec.
npm WARN installMany node-pre-gyp was bundled with iltorb@1.3.1, but bundled package wasn't found in unpacked tree
npm WARN optional dep failed, continuing iltorb@1.3.1

> node-sass@3.13.1 install /vagrant_data/workspace/grafana/src/github.com/grafana/grafana/node_modules/grunt-sass/node_modules/node-sass
> node scripts/install.js

/vagrant_data/workspace/grafana/src/github.com/grafana/grafana/node_modules/grunt-sass/node_modules/node-sass/node_modules/request/node_modules/har-validator/node_modules/ajv/lib/dotjs/validate.js:99
        out += ' { keyword: \'' + ('type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorP
                                                                                                

SyntaxError: Unexpected token ILLEGAL
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant_data/workspace/grafana/src/github.com/grafana/grafana/node_modules/grunt-sass/node_modules/node-sass/node_modules/request/node_modules/har-validator/node_modules/ajv/lib/compile/index.js:18:25)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
npm ERR! Linux 2.6.32-573.22.1.el6.x86_64
npm ERR! argv "/root/.nvm/versions/node/v4.4.2/bin/node" "/root/.nvm/versions/node/v4.4.2/bin/npm" "install"
npm ERR! node v4.4.2
npm ERR! npm  v2.15.0
npm ERR! file /vagrant_data/workspace/grafana/src/github.com/grafana/grafana/node_modules/remarkable/package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token '\u0000' at 82:2
npm ERR!  
npm ERR!  ^
npm ERR! File: /vagrant_data/workspace/grafana/src/github.com/grafana/grafana/node_modules/remarkable/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR! 
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR!     /vagrant_data/workspace/grafana/src/github.com/grafana/grafana/npm-debug.log

I guess the reason is the network is blocked or others. Any idea for it?

Sorry, it was hard to tell which error message belonged to npm install.

Did you try deleting your node_modules and running npm install again?

It is probably something to with not having the correct version of node and npm. See this issue for someone who had similar problems. As you are not using the latest version, it is hard to help you. I don’t know which version of node and npm are needed. Maybe try upgrading your npm to v3 as recommended in the link.

By the way, any reason not to use the latest version of Grafana?

Er, I use the version 3.1.1 for a year more. Now I can’t decide whether to update it because of some custom second development. Actually, I tried to install the latest grafana from source code, but still failed. the reason is same that some packages can’t be installed correctly, maybe due to my network connection, who knows. thank you anyway

Your node and npm versions are definitely too old for the latest version of Grafana.

So for v3.1.1, try upgrading your npm to v3, delete your node_modules directory and then run npm install again. It is really easy to corrupt the node_modules so always start by removing them.

You can also try:

  • installing phantomjs-prebuilt, grunt-sass and node-sass manually after the initial npm install.
  • running npm rebuild node-sass