This page looks best with JavaScript enabled

Some Installation Problems with Node.js

 ·  ☕ 1 min read

1. Installing node-sass

When installing node-sass, the node scripts/install stage downloads a .node file from github.com, and network problems often cause this to fail.

You can add an .npmrc file inside the project to configure a proxy for the installation:

1
2
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
registry=https://registry.npm.taobao.org

Or install with cnpm:

1
2
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install node-sass

2. Installing node-gyp

node-gyp is the build tool used to compile C++ extensions for Nodejs. Here you can find detailed installation instructions for each system.

On Windows:

  • Install node-gyp:
1
npm install -g node-gyp
  • Configure the Python2.7 and VC ++ build Tools dependencies.
1
npm install --global --production windows-build-tools

During compilation and build, node-gyp automatically downloads the required dependencies from overseas servers.

If the download speed is too slow, you can also download the application package yourself. After installing it, configure things with the npm config set python python2.7 and npm config set msvs_version 2015 commands.

3. After switching the Nodejs version, the cache must be rebuilt

1
2
3
4
5
6
7
8
npm cache clean --force
npm update

/data/node8/bin/eslint -> /data/node8/lib/node_modules/eslint/bin/eslint.js
/data/node8/bin/npm -> /data/node8/lib/node_modules/npm/bin/npm-cli.js
/data/node8/bin/npx -> /data/node8/lib/node_modules/npm/bin/npx-cli.js
+ eslint@5.5.0
+ npm@5.10.0

WeChat Official Account
WRITTEN BY
WeChat Official Account