错误:找不到模块@ nuxtjs / firebase

时间:2020-06-17 04:14:01

标签: firebase vue.js nuxt.js

我尝试安装@ nuxtjs / firebase,我在这里遵循了所有说明:https://firebase.nuxtjs.org/guide/getting-started/

但是我得到了错误:

错误:找不到模块@nuxtjs/firebase

enter image description here

3 个答案:

答案 0 :(得分:1)

删除 npm_modules 文件夹并运行npm installyarn install

答案 1 :(得分:0)

如果您的项目已经使用git初始化,请尝试git clean -fdX。它将删除您的node_modulesdistbuild文件夹。然后,尝试使用npm install重新安装所有依赖项。

答案 2 :(得分:0)

已更新!

我不明白为什么,但是我尝试使用



"""
Testing Template for throw away experiment

"""


import sys
import os
import re

from PyQt5 import QtWidgets as qtw
from PyQt5 import QtCore as qtc
from PyQt5 import QtGui as qtg



class DataModel(qtc.QAbstractTableModel):



    def __init__(self, input_data=None):
        super().__init__()

        self.input_data = input_data or [[None], [None], [None], [None], [None]]


    def data(self, index, role):

        if role == qtc.Qt.DisplayRole:
            try:
                text = self.input_data[index.row()][index.column()]
                # self.scaledatachanged_signal.emit() dont need it
            except IndexError:
                text = None

            return text

    def rowCount(self, index=qtc.QModelIndex()):
        return 0 if index.isValid() else len(self.input_data)


    def columnCount(self, index):
        return len(self.input_data[0])

    def headerData(self, section, orientation, role):
        if role == qtc.Qt.DisplayRole:

            if orientation == qtc.Qt.Vertical:
                return "row  " + str(section + 1)



    def flags(self, index):
        return qtc.Qt.ItemIsEditable | qtc.Qt.ItemIsSelectable | qtc.Qt.ItemIsEnabled

    def setData(self, index, value, role=qtc.Qt.EditRole):

        if role == qtc.Qt.EditRole:  # The data in a form suitable for editing in an editor. returns string
            try:
                row = index.row()
                column = index.column()

                # filter floats and digits and comma stuff

                pattern = '^[\d]+(?:[,.][\d]+)?$'  # execepts "," and "."

                if re.fullmatch(pattern, value, flags=0):
                    pattern = '^.*[,].*$'

                    if re.fullmatch(pattern, value, flags=0):

                        value = value.replace(',', '.')

                        self.input_data[row][column] = float(value)

                        print(type(value))

                    else:
                        self.input_data[row][column] = float(value)  # float

                        print(type(value))
                else:
                    pass

                return True

            except ValueError:
                return False

    def insertRows(self, position, rows, parent=qtc.QModelIndex()):
        position = (position + self.rowCount()) if position < 0 else position
        start = position
        end = position + rows - 1
        if end <= 8:
            self.beginInsertRows(parent, start, end)
            self.input_data.append([None])
            self.endInsertRows()
            return True
        else:
            return False

    def removeRows(self, position, rows, parent=qtc.QModelIndex()):
        position = (position + self.rowCount()) if position < 0 else position

        start = position

        end = position + rows - 1
        if end >= 1:
            self.beginRemoveRows(parent, start, end)
            del self.input_data[start:end + 1]
            self.endRemoveRows()
            return True
        else:
            return False

class MainWindow(qtw.QWidget):
    def __init__(self):
        super().__init__()



        self.mytable_view = qtw.QTableView()

        self.mytable_view.setSelectionMode(qtw.QAbstractItemView.SingleSelection)


        self.datamodel = DataModel()
        self.mytable_view.setModel(self.datamodel)

        # widget
        self.addrow_button = qtw.QPushButton("add row")
        self.deleaterow_button = qtw.QPushButton("deleate row")


    # set the layout
        layout = qtw.QVBoxLayout()
        layout.addWidget(self.mytable_view)
        layout.addWidget(self.addrow_button)
        layout.addWidget(self.deleaterow_button)

        self.setLayout(layout)


    # -------------------------------- #
        self.addrow_button.clicked.connect(
            lambda: self.datamodel.insertRows(-1, 1))
        self.deleaterow_button.clicked.connect(
            lambda: self.datamodel.removeRows(-1, 1))

        self.mytable_view.selectionModel().selectionChanged.connect(self.insert_data)


        self.addrow_button.clicked.connect(lambda: self.mytable_view.selectionModel().clearSelection())
        self.deleaterow_button.clicked.connect(lambda: self.mytable_view.selectionModel().clearSelection())



    def insert_data(self):

        x = self.mytable_view.selectionModel().currentIndex().row()
        y = self.mytable_view.selectionModel().currentIndex().column()


        self.datamodel.input_data[x][y] = "insert this string if cell is selected"
        self.datamodel.layoutChanged.emit()
        self.mytable_view.selectionModel().clearSelection()




if __name__ == '__main__':
    app = qtw.QApplication(sys.argv)

    main = MainWindow()
    main.show()

    sys.exit(app.exec_())





我试图删除node_modules,并使用

重新安装
npm i @nuxtjs/firebase --save (Error: Module @nuxtjs/firebase not found.)
npm i firebase --save (firebase package not found)

,效果很好。 希望以后能对某人有所帮助。