##nodejs安装 直接下载nodejs.exe,添加环境变量。 ##npm安装 在https://github.com/npm/npm中下载文件包。解压复制入类似于:
D:\learningtime\nodejs\node_modules\npm的目录。
将npm.cmd拷贝至,与nodejs.exe同级。
D:\learningtime\nodejs
##错误解决
2014.12.25日
D:\ghost-0.5.7>npm install --production
> [email protected] install D:\ghost-0.5.7\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build
。。。。。。
gyp ERR! configure error
gyp ERR! stack Error: spawn ENOENT
gyp ERR! stack at errnoException (child_process.js:1011:11)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:802:34)
gyp ERR! System Windows_NT 5.1.2600
gyp ERR! command "node" 。。。。。。
gyp ERR! cwd D:\ghost-0.5.7\node_modules\sqlite3
gyp ERR! node -v v0.10.34
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd rebuild --name=sqlite3 --configuration=Release --module_name=node_sqlite3 --version=3.0.2 。。。。。。(D:\ghost-0.5.7\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:76:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:98:17)
node-pre-gyp ERR! stack at maybeClose (child_process.js:766:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_proces
s.js:833:5)
node-pre-gyp ERR! System Windows_NT 5.1.2600
node-pre-gyp ERR! command "node" "D:\\ghost-0.5.7\\node_modules\\sqlite3\\node_m
odules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd D:\ghost-0.5.7\node_modules\sqlite3
node-pre-gyp ERR! node -v v0.10.34
node-pre-gyp ERR! node-pre-gyp -v v0.5.27
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd rebuild --name=sqlite3 。。。。。。
/node-v11-win32-ia32.tar.gz' (1)
npm ERR! Windows_NT 5.1.2600
npm ERR! argv "D:\\learningtime\\nodejs\\\\node.exe" "D:\\learningtime\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "--production"
npm ERR! node v0.10.34
npm ERR! npm v2.1.16
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fall
back-to-build'.
npm ERR! This is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! D:\ghost-0.5.7\npm-debug.log
原因是: 1、ghost版本支持v0.10.26版本的nodejs。 2、node-gyp需要Microsoft Visual Studio C++ 2010 (Express version works well),Python (v2.7.3 recommended, v3.x.x is not supported)。 3、If you have multiple Python versions installed, you can identify which Python version node-gyp uses by setting the ‘–python’ variable:
$ node-gyp --python /path/to/python2.7
If node-gyp is called by way of npm and you have multiple versions of Python installed, then you can set npm’s ‘python’ config key to the appropriate value:
$ npm config set python /path/to/executable/python2.7
4、You can install with npm:
$ npm install -g node-gyp
5、I was getting the same problem. Solved defining the env variables:
PYTHONPATH=C:\Pyhon
PYTHON=%PYTHONPATH%\python.exe