Я импортирую d3 в модуль следующим образом:
import * as d3 from "d3"
И приложение работает на локальном хосте, как задумано, вместе с созданием желаемых диаграмм. Но когда я отправляю sh в heroku, прекомпиляция завершается неудачно.
Я не касался ни одного веб-пакета или конфигурации веб-пакера, все такое, как было предоставлено Rails.
Я не нашел много упоминание об этой ситуации, кроме той, в которой она была разрешена путем указания прямого пути к d3 в операторе импорта. Я пробовал это, но ошибки не изменились.
Есть идеи, как решить эту проблему и обеспечить успешное развертывание в Heroku?
Спасибо!
package. json
{
"name": "the_app",
"private": true,
"dependencies": {
"@rails/actioncable": "^6.0.0",
"@rails/activestorage": "^6.0.0",
"@rails/ujs": "^6.0.0",
"@rails/webpacker": "4.2.2",
"turbolinks": "^5.2.0"
},
"version": "0.1.0",
"devDependencies": {
"d3": "^5.16.0",
"webpack-dev-server": "^3.10.3"
}
}
Ошибки
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: yarn install v1.16.0
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: info fsevents@1.2.12: The platform "linux" is incompatible with this module.
remote: info "fsevents@1.2.12" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: [3/4] Linking dependencies...
remote: warning " > webpack-dev-server@3.10.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
remote: warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
remote: [4/4] Building fresh packages...
remote: Done in 23.83s.
remote: yarn install v1.16.0
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: info fsevents@1.2.12: The platform "linux" is incompatible with this module.
remote: info "fsevents@1.2.12" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: [3/4] Linking dependencies...
remote: warning " > webpack-dev-server@3.10.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
remote: warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
remote: [4/4] Building fresh packages...
remote: Done in 4.98s.
remote: I, [2020-05-28T00:58:16.236509 #435] INFO -- : Writing /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/public/assets/application-e9ef9b65582d84e0bcb1825908e96a08d055278ce584c687748a7dbd3a739747.css
remote: I, [2020-05-28T00:58:16.236817 #435] INFO -- : Writing /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/public/assets/application-e9ef9b65582d84e0bcb1825908e96a08d055278ce584c687748a7dbd3a739747.css.gz
remote: I, [2020-05-28T00:58:16.237059 #435] INFO -- : Writing /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/public/assets/main-e9ef9b65582d84e0bcb1825908e96a08d055278ce584c687748a7dbd3a739747.css
remote: I, [2020-05-28T00:58:16.237229 #435] INFO -- : Writing /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/public/assets/main-e9ef9b65582d84e0bcb1825908e96a08d055278ce584c687748a7dbd3a739747.css.gz
remote: Compiling...
remote: Compilation failed:
remote: ModuleNotFoundError: Module not found: Error: Can't resolve 'd3' in '/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/modules'
remote: at factory.create (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/lib/Compilation.js:925:10)
remote: at factory (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/lib/NormalModuleFactory.js:401:22)
remote: at resolver (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/lib/NormalModuleFactory.js:130:21)
remote: at asyncLib.parallel (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/lib/NormalModuleFactory.js:224:22)
remote: at /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/neo-async/async.js:2830:7
remote: at /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/neo-async/async.js:6877:13
remote: at normalResolver.resolve (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/lib/NormalModuleFactory.js:214:25)
remote: at doResolve (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:213:14)
remote: at hook.callAsync (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote: at _fn0 (eval at create (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
remote: at resolver.doResolve (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7)
remote: at hook.callAsync (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote: at _fn0 (eval at create (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
remote: at hook.callAsync (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote: at _fn0 (eval at create (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
remote: at resolver.doResolve (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43)
remote: at hook.callAsync (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote: at _fn41 (eval at create (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:28:1)
remote: at resolver.doResolve (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:30:40)
remote: at hook.callAsync (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote: at _fn0 (eval at create (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
remote: at hook.callAsync (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote: at _fn1 (eval at create (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
remote: at args (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/forEachBail.js:30:14)
remote: at hook.callAsync (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote: at _fn0 (eval at create (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
remote: at resolver.doResolve (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7)
remote: at hook.callAsync (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote: at _fn0 (eval at create (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
remote: at hook.callAsync (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote: at _fn0 (eval at create (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
remote: at resolver.doResolve (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43)
remote: at hook.callAsync (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote: at _fn42 (eval at create (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
remote: at hook.callAsync (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote: at _fn0 (eval at create (/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
remote: resolve 'd3' in '/tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/modules'
remote: Parsed request is a module
remote: using description file: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/package.json (relative path: ./app/javascript/modules)
remote: Field 'browser' doesn't contain a valid alias configuration
remote: resolve as module
remote: looking for modules in /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript
remote: using description file: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/package.json (relative path: ./app/javascript)
remote: Field 'browser' doesn't contain a valid alias configuration
remote: using description file: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/package.json (relative path: ./app/javascript/d3)
remote: no extension
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3 doesn't exist
remote: .mjs
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3.mjs doesn't exist
remote: .js
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3.js doesn't exist
remote: .sass
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3.sass doesn't exist
remote: .scss
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3.scss doesn't exist
remote: .css
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3.css doesn't exist
remote: .module.sass
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3.module.sass doesn't exist
remote: .module.scss
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3.module.scss doesn't exist
remote: .module.css
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3.module.css doesn't exist
remote: .png
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3.png doesn't exist
remote: .svg
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3.svg doesn't exist
remote: .gif
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3.gif doesn't exist
remote: .jpeg
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3.jpeg doesn't exist
remote: .jpg
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3.jpg doesn't exist
remote: as directory
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/d3 doesn't exist
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/modules/node_modules doesn't exist or is not a directory
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/javascript/node_modules doesn't exist or is not a directory
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/app/node_modules doesn't exist or is not a directory
remote: /tmp/node_modules doesn't exist or is not a directory
remote: /node_modules doesn't exist or is not a directory
remote: looking for modules in /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules
remote: using description file: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/package.json (relative path: ./node_modules)
remote: Field 'browser' doesn't contain a valid alias configuration
remote: using description file: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/package.json (relative path: ./node_modules/d3)
remote: no extension
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3 doesn't exist
remote: .mjs
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3.mjs doesn't exist
remote: .js
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3.js doesn't exist
remote: .sass
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3.sass doesn't exist
remote: .scss
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3.scss doesn't exist
remote: .css
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3.css doesn't exist
remote: .module.sass
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3.module.sass doesn't exist
remote: .module.scss
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3.module.scss doesn't exist
remote: .module.css
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3.module.css doesn't exist
remote: .png
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3.png doesn't exist
remote: .svg
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3.svg doesn't exist
remote: .gif
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3.gif doesn't exist
remote: .jpeg
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3.jpeg doesn't exist
remote: .jpg
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3.jpg doesn't exist
remote: as directory
remote: /tmp/build_ee117d42c87cfaf2c16b46c6bf931917/node_modules/d3 doesn't exist
remote:
remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to the-app