我正在尝试将我的节点应用程序推送到heroku,但是在服务器上找不到semantic.css和semantic.js。所有东西在本地都能正常工作(即使是只使用npm install和npm start的新安装)。
它们是在我的app.js中提供的
app.use(express.static(path.join(__dirname, 'public')));
app.use('/jquery', express.static(path.join(__dirname, '/node_modules/jquery/dist/')));
app.use('/semantic', express.static(path.join(__dirname + '/semantic/dist/')));检索jquery.js文件(并像语义文件一样提供服务)。
semantic/dist目录使用npm postinstall脚本运行的gulp任务填充。
在部署heroku应用程序时,我可以看到以下警告:
Ignoring local @import of "../../../semantic/src/definitions/tab.css" as resource is missing.
Created: semantic/public/semantic/components/tab.css
Plumber found unhandled error:
Ignoring local @import of "../../../semantic/src/definitions/transition.css" as resource is missing.
Starting 'package compressed css'...
Created: semantic/public/semantic/components/transition.css
Starting 'package uncompressed css'...
Plumber found unhandled error:
Ignoring local @import of "../../../../semantic/public/semantic/components/semantic.min.css" as resource is missing.
Finished 'package compressed css' after 1.6 s
Created: semantic/public/semantic/semantic.css
Finished 'package uncompressed css' after 1.5 s
Finished 'build-css' after 20 s
Finished 'build' after 20 s我错过了什么?
编辑
经过一些调试(即:在postinstall脚本中运行ls semantic ),似乎没有在语义文件夹中生成dist文件夹。为什么会这样呢?
发布于 2017-09-29 23:17:58
这里有一个可能的问题:
app.use('/semantic', express.static(path.join(__dirname + '/semantic/dist/')));
您正在使用path.join和连接(__dirname + '/semantic/dist/'),而不是传入两个参数:(__dirname, '/semantic/dist/')
https://stackoverflow.com/questions/46497213
复制相似问题