Solidity

松露找不到腳本文件

  • April 17, 2021

我正在嘗試在我的松露項目中執行一個腳本。該腳本位於腳本文件夾中。但是無論我是從項目的根目錄中還是在腳本文件夾中執行命令,似乎都找不到位於另一個項目中的文件 NiftRouter01.sol。我正在使用命令truffle exec './deploy_pool.js' --network bscTestnet

C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\commands.bundled.js:455204
       throw new Error("Could not find artifacts for " + import_path + " from any sources");
       ^

Error: Could not find artifacts for ../../niftswap-periphery/build/contracts/NiftRouter01.json from any sources
   at Resolver.require (C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\resolver\dist\lib\resolver.js:43:1)
   at D:\Blockchain\pancake\pancakeswap-core\scripts\deploy_pool.js:2:26
   at Script.runInContext (vm.js:131:20)
   at Script.runInNewContext (vm.js:137:17)
   at Object.file (C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\require\require.js:94:1)    
   at Object.exec (C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\require\require.js:121:1)   
   at internal/util.js:297:30
   at new Promise (<anonymous>)
   at bound exec (internal/util.js:296:12)
   at C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\exec.js:88:1
Truffle v5.1.49 (core: 5.1.49)
Node v12.18.0

我能夠通過從腳本名稱中刪除 - 來解決這個問題,刪除 node_modules 文件夾和 package.json 並強制 npm 記憶體清理。還將腳本放在外部文件夾中。

引用自:https://ethereum.stackexchange.com/questions/97288