Javascript 找不到模块';样式化jsx/style';生产中的火基
我构建了下一个js应用程序,我正在尝试为其添加一些css。 尝试使用内置样式的jsx css库。在当地,一切都很好 现在,当我在firebase主机中上传相同的内容并使用firebase函数尝试SSR时。我得到这个错误 问题是:如果样式化jsx是下一个js的一部分,那么我为什么会看到这个错误。这也只是在生产中Javascript 找不到模块';样式化jsx/style';生产中的火基,javascript,reactjs,next.js,server-side-rendering,Javascript,Reactjs,Next.js,Server Side Rendering,我构建了下一个js应用程序,我正在尝试为其添加一些css。 尝试使用内置样式的jsx css库。在当地,一切都很好 现在,当我在firebase主机中上传相同的内容并使用firebase函数尝试SSR时。我得到这个错误 问题是:如果样式化jsx是下一个js的一部分,那么我为什么会看到这个错误。这也只是在生产中 Error: Cannot find module 'styled-jsx/style' at Function.Module._resolveFilename (module.
Error: Cannot find module 'styled-jsx/style'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/user_code/next/server/bundles/pages/mystatus.js:245:18)
at __webpack_require__ (webpack:/webpack/bootstrap 51b5f67292a9fe79adac:21:0)
at Object.<anonymous> (/user_code/next/server/bundles/pages/mystatus.js:101:75)
at __webpack_require__ (webpack:/webpack/bootstrap 51b5f67292a9fe79adac:21:0)
at Object.module.exports.Object.defineProperty.value (/user_code/next/server/bundles/pages/mystatus.js:89:18)
at __webpack_require__ (webpack:/webpack/bootstrap 51b5f67292a9fe79adac:21:0) code: 'MODULE_NOT_FOUND', sourceMapsApplied:
使用nextjs6+
我知道我总是可以添加样式化的jsx作为依赖项,但我试图理解为什么它不起作用,因为它应该已经内置到下一个js中了
提前谢谢
这是我的package.json内容:
"dependencies": {
"@babel/runtime": "^7.1.2",
"firebase": "^5.5.3",
"firebase-admin": "^5.12.1",
"firebase-functions": "^2.0.5",
"next": "^6.1.1",
"react": "^16.4.0",
"react-dom": "^16.4.0"
},
"devDependencies": {
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"@firebase/app-types": "^0.3.2",
"cpx": "^1.5.0",
"firebase-tools": "^3.18.6",
"prettier": "^1.13.5",
"rimraf": "^2.6.2"
}
错误:
Error: Cannot find module 'styled-jsx/style'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/user_code/next/server/bundles/pages/mystatus.js:245:18)
at __webpack_require__ (webpack:/webpack/bootstrap 51b5f67292a9fe79adac:21:0)
at Object.<anonymous> (/user_code/next/server/bundles/pages/mystatus.js:101:75)
at __webpack_require__ (webpack:/webpack/bootstrap 51b5f67292a9fe79adac:21:0)
at Object.module.exports.Object.defineProperty.value (/user_code/next/server/bundles/pages/mystatus.js:89:18)
at __webpack_require__ (webpack:/webpack/bootstrap 51b5f67292a9fe79adac:21:0) code: 'MODULE_NOT_FOUND', sourceMapsApplied:
错误:找不到模块'styled jsx/style'
在Function.Module.\u解析文件名(Module.js:476:15)
在Function.Module.\u加载(Module.js:424:25)
at Module.require(Module.js:504:17)
根据需要(内部/module.js:20:19)
反对。(/user_code/next/server/bundles/pages/mystatus.js:245:18)
at\uuuu网页包\uuuu需要(网页包:/webpack/bootstrap 51b5f67292a9fe79adac:21:0)
反对。(/user_code/next/server/bundles/pages/mystatus.js:101:75)
at\uuuu网页包\uuuu需要(网页包:/webpack/bootstrap 51b5f67292a9fe79adac:21:0)
在Object.module.exports.Object.defineProperty.value(/user\u code/next/server/bundles/pages/mystatus.js:89:18)
在uuu webpack_urequire_uuuu(webpack:/webpack/bootstrap 51b5f67292a9fe79adac:21:0)代码:“未找到模块”,源映射应用:
您收到了什么错误?更新的错误堆栈您是否确保下一步
不仅作为依赖项添加到应用程序
文件夹中,而且作为依赖项添加到函数
文件夹的包.json
?