Итак, я хочу начать играть с API листов Google.Я следовал инструкциям, указанным здесь:
https://codelabs.developers.google.com/codelabs/sheets-api/#2
Я установил node.js & git (свежие установки)
Затем я вытащил файлы из git,и затем запустил npm install - никаких проблем пока нет.
Затем я запустил npm start и получил следующую ошибку
$ npm start
sheets-api-codelab@1.0.0 start C:\Users\sbala\Projects\sheets-api\start
nodemon server.js
[nodemon] 1.17.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
C:\Users\sbala\Projects\sheets-api\start\node_modules\sequelize\lib\dialects\sqlite\connection-manager.js:27
throw err;
^
Error: \\?\C:\Users\sbala\Projects\sheets-
api\start\node_modules\sqlite3\lib\binding\node-v57-win32-x64\node_sqlite3.node is not a valid Win32 application.
\\?\C:\Users\sbala\Projects\sheets- api\start\node_modules\sqlite3\lib\binding\node-v57-win32-x64\node_sqlite3.node at Object.Module._extensions..node (module.js:681:18) at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\sbala\Projects\sheets-api\start\node_modules\sqlite3\lib\sqlite3.js:4:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at new ConnectionManager (C:\Users\sbala\Projects\sheets-api\start\node_modules\sequelize\lib\dialects\sqlite\connection-manager.js:22:16)
at new SqliteDialect (C:\Users\sbala\Projects\sheets-api\start\node_modules\sequelize\lib\dialects\sqlite\index.js:12:28)
[nodemon] app crashed - waiting for file changes before starting...
Я попытался найти решение, но, кажется, приложение можетпадение по многим причинам, и я не могу найти тот, который мне помогает.Я попытался повторно установить npm и запустить npm несколько раз, и я продолжаю получать ту же ошибку в строке sqlitedialect.Таким образом, я могу только предположить, что с sqlite что-то пошло не так?
это моя npm-версия
$ npm version
{ 'sheets-api-codelab': '1.0.0',
npm: '6.0.1',
ares: '1.10.1-DEV',
cldr: '32.0',
http_parser: '2.8.0',
icu: '60.1',
modules: '57',
nghttp2: '1.25.0',
node: '8.11.1',
openssl: '1.0.2o',
tz: '2017c',
unicode: '10.0',
uv: '1.19.1',
v8: '6.2.414.50',
zlib: '1.2.11' }
и мой файл package.json
{
"name": "sheets-api-codelab",
"description": "In this codelab, you'll learn how to integrate the Google Sheets API into an application to provide custom reporting.",
"version": "1.0.0",
"license": "Apache-2.0",
"author": {
"name": "Eric Koleda",
"email": "ekoleda+devrel@googlers.com"
},
"repository": "https://github.com/googlecodelabs/sheets-api",
"scripts": {
"start": "nodemon server.js"
},
"dependencies": {
"body-parser": "~1.13.2",
"express": "^4.13.4",
"express-handlebars": "^3.0.0",
"morgan": "^1.7.0",
"sequelize": "^3.21.0",
"sqlite3": "^3.1.3"
},
"devDependencies": {
"nodemon": "^1.9.1"
}
}
ServerФайл .js здесь
#!/usr/bin/env node
/*
Copyright 2016 Google, Inc.
Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for
additional information regarding copyright ownership. The ASF licenses this
file to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
*/
'use strict';
/**
* Module dependencies.
*/
var app = require('./app');
var http = require('http');
var models = require('./models');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Load the models.
*/
models.sequelize.sync().then(function() {
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
});
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string' ? 'Pipe ' + port : 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;
console.log('Listening on ' + bind);
}