Plugin Creation/Building: Node-sass Error

While attempting the panel plugin tutorial using Amazon Linux 1, ran into an issue with node-sass. First I set user to root and set up proxies:

sudo bash
export http_proxy=http://proxy.X.com:80
export https_proxy=http://proxy.X.com:80

Then created the plugin directory and set ownership:

cd /etc/grafana/
mkdir grafana-plugins
chown root:grafana grafana-plugins

Then installed Node.js (12.18.1), npm (6.14.5) and yarn (1.22.4) with the following commands:

curl -sL https://rpm.nodesource.com/setup_12.x | bash -
yum install -y nodejs
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
yum install yarn

Restarted Grafana and changed directories:

service grafana-server restart
cd grafana-plugins

Then encountered the error with next command:

[root@ip-10-56-250-233 20200612 18:37:40 grafana-plugins]# npx @grafana/toolkit plugin:create my-plugin
internal/modules/cjs/loader.js:1032
throw err;
^

Error: Cannot find module '/root/.npm/_npx/1554/lib/node_modules/@grafana/toolkit/node_modules/node-sass/scripts/install.js ’
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
at Function.Module._load (internal/modules/cjs/loader.js:898:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: ‘MODULE_NOT_FOUND’,
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.14.1 install:  `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.14.1 install 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! /root/.npm/_logs/2020-06-12T18_41_43_413Z-debug.log
Install for [ ‘@grafana/toolkit@latest’ ] failed with code 1

I have also used example plugins from Grafana and tried to build them with yarn using the next tutorial instructions, but ended up with similar errors due to node-sass. Hence, I have attempted various ways to install node-sass and all produce errors involving either MODULE_NOT_FOUND (npm w/out --unsafe-perm) or a proxy 403 error (npm w/ --unsafe-perm or using yarn):

npm install node-sass
npm install --unsafe-perm -g node-sass
yarn add node-sass

Providing an update: It was found that the corporate proxy was preventing the binary download for node-sass. Once that was resolved, I was able to successfully install node-sass (v4.14.1) globally with the command ‘npm install --unsafe-perm -g node-sass’. However, the same error result happens when using the npx command to a create a sample plugin in that it cannot located node-sass.

An alternative strategy was attempted by using the simple react panel (https://github.com/grafana/simple-react-panel), as suggested in another post:

The plugin was able to install locally, however, it does not appear on the console plugin list as discussed in this post:

Issue was resolved for manual installtion. Required setting ownership permission recursively to the installed plugin folders, as well as making sure all instances in system that were running Grafana used same configuration for console.

Commands:

chown -R grafana:grafana /var/lib/grafana/plugins
chmod -R 700 /var/lib/grafana/plugins